Woocommerce - Hide shop for unregistered user
Date : March 29 2020, 07:55 AM
Does that help You don't need to modify Woocommerce template file for what you are trying to achieve. Just add the following code to functions.php function custom_redirect() {
if( is_shop() && ! is_user_logged_in() ) {
wp_redirect( home_url() );
exit();
}
}
add_action("template_redirect","custom_redirect");
|
hide some category names from products in woocommerce shop
Date : March 29 2020, 07:55 AM
it helps some times WooCommerce provides some coarse control over displaying sub categories in your shop/category pages with the “Show subcategories on category pages” and “Show subcategories on the shop page” options on the WooCommerce > Settings > Catalog > Catalog Options section. These controls are all-or-nothing though: show all subcategories on the category pages, or show all subcategories on the shop page. If you want finer-grained control, for instance displaying only certain subcategories on the shop or particular subcategories on a given category catalog page, you’ll need to write a little custom code, and there are a couple of approaches you can take.
|
Hide out of stock products only on shop archive pages in Woocommerce
Tag : php , By : Bimal Poudel
Date : March 29 2020, 07:55 AM
this one helps. Updated: Using a custom function hooked in woocommerce_product_query_meta_query filter hook, targeting non "out of stock" products on shop archive pages only: add_filter( 'woocommerce_product_query_meta_query', 'shop_only_instock_products', 10, 2 );
function shop_only_instock_products( $meta_query, $query ) {
// Only on shop archive pages
if( is_admin() || is_search() || ! is_shop() ) return $meta_query;
$meta_query[] = array(
'key' => '_stock_status',
'value' => 'outofstock',
'compare' => '!='
);
return $meta_query;
}
|
WooCommerce: Hide Product Loop on Shop Page
Tag : php , By : cthulhup
Date : March 29 2020, 07:55 AM
it helps some times I am using the following code to hide the product loop on the Woo shop page: , Change your wc_no_products_found function with this one add_action( 'woocommerce_no_products_found', function(){
if(is_shop()) {
remove_action( 'woocommerce_no_products_found', 'wc_no_products_found', 10 );
}
}, 9 );
|
hide category name under products on woocommerce shop page
Date : March 29 2020, 07:55 AM
To fix the issue you can do I checked your website. Add this to Custom CSS to hide the categories of products on shop page: a.cmsmasters_cat_color {
display: none;
}
|