简体   繁体   中英

How I can hide bulk products or Price in WooCommerce?

I am using WooCommerce in WordPress. I have a lot of products with different prices. I just want to hide products which have $35 price bracket. I don't want to do it one by one using editor. I want a solution with code because 5000+ products have $35 price.

You can try with the woocommerce_product_is_visible hook

add_filter( 'woocommerce_product_is_visible', 'hide_35', 10, 2 );
 
function hide_35( $visible, $id ){
    $product = wc_get_product( $id );
    if( $product->get_regular_price() == 35 ){
        return false;
    }
    return $visible;
}

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM