– I need to sort all products that shows in woodmart carousel by InStock first for instance if we sort our product by date we need to have in stock products first then out of stock products.
I did that to default woocommerce product grid by this code but it\’s not working on woodmart product carousel.
add_filter(\’posts_clauses\’, \’order_by_stock_status\’,9999);
function order_by_stock_status($posts_clauses) {
global $wpdb;
// only change query on WooCommerce loops
if (is_woocommerce() && (is_shop() || is_product_category() || is_product_tag() || is_product_taxonomy())) {
$posts_clauses[\’join\’] .= \” INNER JOIN $wpdb->postmeta istockstatus ON ($wpdb->posts.ID = istockstatus.post_id) \”;
$posts_clauses[\’orderby\’] = \” istockstatus.meta_value ASC, \” . $posts_clauses[\’orderby\’];
$posts_clauses[\’where\’] = \” AND istockstatus.meta_key = \’_stock_status\’ AND istockstatus.meta_value <> \’\’ \” . $posts_clauses[\’where\’];
}
return $posts_clauses;
}
– also i need to have \”Show More\” button next to product carousel title, let me explane that we have 4 product carousel in our main page that shows A,B,C,D products categories i need to have a link to show all products in A category next to carousel title somthing like this:
https://ollo.market/