1

Making WooCommerce e-shop and stuck with single product images. They are absolutely static. When clicking on any image from gallery, then browser links me to separate page with image, but not switching main image. Also on main image doesn't zoom on hover. Here is a website uploaded on server

Please help to figure out where can be the problem.

1 Answer 1

1

my solution works for who makes a theme from zero (not using WordPress ready themes)

  1. make a Backup from your WordPress theme
  2. go to wp-content/plugins/woocommerce and find and copy a directory which name is templates into wp-content/themes/your-theme and rename it to woocommerce
  3. in your theme directory, create a file and name it woocommerce.php and add these lines in it:
<!DOCTYPE html>
<html lang="en">
<head>
    <?php get_header(); ?>
</head>
<body <?php body_class(); ?>>
    <div class="woocommerce">
        <?php woocommerce_content(); ?>
    </div>
    <?php get_footer(); ?>
</body>
</html>
  1. then add this codes to your theme functions.php :

<?php
function web_add_woocommerce_support() {
    add_theme_support( 'woocommerce' );
}
add_theme_support( 'wc-product-gallery-zoom' );
add_theme_support( 'wc-product-gallery-lightbox' );
add_theme_support( 'wc-product-gallery-slider' );
add_action( 'after_setup_theme', 'web_add_woocommerce_support' );
?>

note(1): be sure you have single.php and page.php.
note(2): be sure your <body> tags is like this: <body <?php body_class(); ?>>

1
  • Thank you. Copied 4. code to woocommerce.php and it worked.
    – Flagmans
    Nov 15, 2021 at 13:59

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.