Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR TYPESCRIPT

query products by category woocommerce

$args = array(
   'post_type'             => 'product',
   'post_status'           => 'publish',
   'ignore_sticky_posts'   => 1,
   'posts_per_page'        => '12',
   'tax_query'             => array(
        array(
            'taxonomy'  => 'product_cat',
            'field'     => 'term_id',
            'terms'     => array('40'),
            'operator'  => 'IN',
        )
   )
);

$loop = new WP_Query( $args );
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #query #products #category #woocommerce
ADD COMMENT
Topic
Name
7+7 =