Woocommerce functions.php to filter out products with no price
-
I am trying to write some php to filter out products that have no price listed in the product catalog using the woocommerce_product_is_visible filter.
I tried the following code but it doesn’t do anything:
add_filter( 'woocommerce_product_is_visible', 'hide_product_if_zero_price', 10, 2 ); function hide_product_if_zero_price( $visible, $product ){ if ( '' === $product->get_price() ) { $visible = false; } return $visible; }The blog I need help with is: (visible only to logged in users)
-
Hi there!
It sounds like your question is specific to WooCommerce running on a self-hosted WordPress.org site. We generally help with WordPress.com sites on this forum. Please post this on the WooCommerce support forum at this link so that you can get help from the WooCommerce support team.
Thanks!
- The topic ‘Woocommerce functions.php to filter out products with no price’ is closed to new replies.