Woocommerce loop shop removal code help

Posted in: Newspaper
Post count: 33

Dear TagDiv,

I been searching the forum for this code you provide to remove Woocommerce loop shop on the default page:

add_action( ‘pre_get_posts’, ‘bbloomer_remove_products_from_shop_page’ );

function bbloomer_remove_products_from_shop_page( $q ) {

if ( ! $q->is_main_query() ) return;
if ( ! $q->is_post_type_archive() ) return;

if ( ! is_admin() && is_shop() ) {

$q->set( ‘tax_query’, array(array(
‘taxonomy’ => ‘product_cat’,
‘field’ => ‘slug’,
‘terms’ => array( ‘null’ ),
‘operator’ => ‘IN’
)));

}

remove_action( ‘pre_get_posts’, ‘bbloomer_remove_products_from_shop_page’ );

}

add_action( ‘woocommerce_no_products_found’, function(){

if(is_shop()) {
remove_action( ‘woocommerce_no_products_found’, ‘wc_no_products_found’, 10 );
}
}, 9 );

#####################

Where do I paste them to?

Please help

Post count: 35449

Hi,

You need to set the code in functions -> https://www.screencast.com/t/dNHGeLEMd9p
You can check a similar topic -> https://forum.tagdiv.com/topic/customize-woocomerce-homepage/

Thank you!

Viewing 2 posts - 1 through 2 (of 2 total)
The forum ‘Newspaper’ is closed to new topics and replies.