Hello,
Im creating the shortocde for most-selling products in time period. I need the “Ajax” based paginate. Im using default Woo shortcodes for this example: [products per_page=10 limit="100" paginate=true ids="1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,18,19"] and pagination doesn’t work in your theme, can you helep me about this?
You need to use our theme’s Products WPBakery element instead. It has an “AJAX arrows” type for pagination. Note that standard pagination is available for the shop page only.
I need create custom PHP list of products based on SQL query. Do you have some idea how to do?
SQL:
"
SELECT p.ID as id, COUNT(oim2.meta_value) as count
FROM {$wpdb->prefix}posts p
INNER JOIN {$wpdb->prefix}woocommerce_order_itemmeta oim
ON p.ID = oim.meta_value
INNER JOIN {$wpdb->prefix}woocommerce_order_itemmeta oim2
ON oim.order_item_id = oim2.order_item_id
INNER JOIN {$wpdb->prefix}woocommerce_order_items oi
ON oim.order_item_id = oi.order_item_id
INNER JOIN {$wpdb->prefix}posts as o
ON o.ID = oi.order_id
WHERE p.post_type = 'product'
AND p.post_status = 'publish'
AND o.post_status IN ('wc-completed')
AND o.post_date >= '$curent_month'
AND oim.meta_key = '_product_id'
AND oim2.meta_key = '_qty'
GROUP BY p.ID
ORDER BY COUNT(oim2.meta_value) + 0 DESC
$limit_clause
"