• Hi

    I’m trying to remove the product gallery from all my woocommerce products. I’m using the gallery only to display an alternate view of the product in the shop page when hovering an image but I don’t want it to be loaded in single product page.

    I’ve tried this method but it doens’t seem to work:

    if ( is_single) {
    		remove_action( 'woocommerce_product_thumbnails', 'action_woocommerce_product_thumbnails', 10, 2 );
    	}

    Any suggestions?

    https://wordpress.org/plugins/woocommerce/

Viewing 2 replies - 1 through 2 (of 2 total)
  • Thomas Shellberg

    (@shellbeezy)

    Automattic Happiness Engineer

    Your code is going to be executed too early for that to have an effect. You need to wrap this in a function and hook into another add_action hook.

    Thread Starter Xaifu

    (@xaifu)

    Thanks Thomas,

    I finally got it working:

    add_action( 'wp', 'remove_product_gallery' );
    function remove_product_gallery( $woocommerce_show_product_thumbnails, $int ) {
    if ( is_single) {
    		remove_action( 'woocommerce_product_thumbnails', 'woocommerce_show_product_thumbnails', 20 );
    	}
    }
Viewing 2 replies - 1 through 2 (of 2 total)

The topic ‘Remove product gallery’ is closed to new replies.