نمایش ندادن محصولات متغیر

Mesmaili

کاربر عضو
سلام دوستان

1 موردی هست پیر من رو در آورده :)))

از قطعه کد زیر برای نمایش محصولات تخفیف خورده استفاده میکنم :

<?php
// On sale products
$sale_args = array(
'post_type' => 'product',
'posts_per_page' => 8,
'orderby' =>'rand',
'order' => 'DESC',
'meta_query' => array(
'relation' => 'OR',
array( // Simple products type
'key' => '_sale_price',
'value' => 0,
'compare' => '>',
'type' => 'numeric'
),
array( // Variable products type
'key' => '_min_variation_sale_price',
'value' => 0,
'compare' => '>',
'type' => 'numeric'
)
)
);
$products = new WP_Query( $sale_args );
?>


متاسفانه این کد تنها محصولات ساده رو نمایش میده و محصولات متغیر رو نمایش نمیده.

وقتی هم :
'post_type' => array('product', 'product_variation')
رو اضافه میکنم، حالت متغیر تنها یکی از محصولات رو نمایش میده

 
بالا