'wc_get_template_part wocommerce does not display the content in rest api
hello guys when i try to loop products it's just display the div but not product info
or the image of the result from console
as you see it's just display the divs but not the content
this is the code:
function stsearch_products($data) {
$args = array(
'post_type' => 'product',
'product', 'posts_per_page' => -1,
'order' => 'ASC' // ASC
);
$args['s'] = $data['search-title'];
$loop = new WP_Query( $args );
ob_start();
if ( $loop->have_posts() ) :
do_action( 'woocommerce_before_shop_loop' );
woocommerce_product_loop_start();
while ( $loop->have_posts() ) :
$loop->the_post();
wc_get_template_part( 'content', 'product' );
endwhile;
woocommerce_product_loop_end();
do_action( 'woocommerce_after_shop_loop' );
else :
do_action( 'woocommerce_no_products_found' );
endif;
wp_reset_postdata();
return ob_get_clean();
}
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
