• Resolved sebasjuh

    (@sebasjuh)


    Hello,

    I have the following snippet in use

    add_action( 'woocommerce_product_query', 'react2wp_hide_products_without_price' );
    function react2wp_hide_products_without_price( $q ){
       $meta_query = $q->get( 'meta_query' );
       $meta_query[] = array(
          'key'       => '_price',
          'value'     => '',
          'compare'   => '!='
       );
       $q->set( 'meta_query', $meta_query );
    }

    With this snippet I hide the product with no price from my shop page.

    Is it also possible to have a snippet like this but then for the woocommerce shortcode recent_products?

    Because I use this shortcode on my page:
    [recent_products per_page=”6″ columns=”6″ orderby=”date” order=”desc”]

    And in this shortcode the product without any price are shown and I also want to hide these products without any price from the woocommerce shortcode.

Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
  • The topic ‘Remove product without price from shortcode recent products’ is closed to new replies.