I managed to get the store names of all of the current vendors to display in a <ul> tag but it seems that when I loop to get the products, all of the products registered gets displayed under the store name.
How would I go about getting the products that are unique to the store name?
Это проект WordPress, woocommerce и dokan.
История пользователя;
Как пользователь, я увижу название магазина продавца и смогу увидеть всепродуктов продавца под названием магазина продавца.
<div id="dokan-seller-listing-wrap">
<div class="seller-listing-content">
<?php if ( $sellers['users'] ) : ?>
<ul class="dokan-seller-wrap">
<?php
foreach ( $sellers['users'] as $seller ) {
$store_info_author = dokan_get_store_info( $post->post_author );
$store_info = dokan_get_store_info( $seller->ID );
$store_name = isset( $store_info['store_name'] ) ? esc_html( $store_info['store_name'] ) : __( 'N/A', 'dokan-lite' );
$store_url = dokan_get_store_url( $seller->ID );
$featured_seller = get_user_meta( $seller->ID, 'dokan_feature_seller', true );
?>
<div class="row">
<div class="col-md-12">
<div class="store-data">
<h2><a href="<?php echo esc_attr($store_url); ?>"><?php echo esc_html($store_name); ?></a></h2>
</div>
</ul>
<li class="slides">
<?php
$args = array(
'post_type' => 'product',
'posts_per_page' => 12
);
$loop = new WP_Query( $args );
if ($sellers['users']) {
while ( $loop->have_posts() ) : $loop->the_post();
wc_get_template_part( 'content','product' );
endwhile;
} else {
echo __( 'No products found' );
}
wp_reset_postdata();
?>
</li><!--/.products-->
<?php } ?>
</div>
</div>
</div>
</div>