Show Out of stock products at the end
complete
John Morgan
complete
Released in update 7.6
Abdullah Al Menon
Exciting news for us ❤️❤️💥💥💥
John Morgan
in progress
John Morgan
Merged in a post:
Move Out of Stock items at the end of archive list
R
Razvan Lica
When having and Archive list, the out of stock products to be move at the end of the list and also to have them greyed out.
И
Илья
Hello!
Code for function.php for this:
function custom_product_query( $clauses, $query ) {
global $wpdb;
$clauses['join'] .= "
LEFT JOIN {$wpdb->prefix}postmeta out_of_stock_meta
ON ({$wpdb->prefix}posts.ID = out_of_stock_meta.post_id
AND out_of_stock_meta.meta_key = '_stock_status'
AND out_of_stock_meta.meta_value = 'outofstock')
";
$clauses['orderby'] = "out_of_stock_meta.meta_value ASC, {$clauses['orderby']}";
return $clauses;
}
add_filter( 'posts_clauses', 'custom_product_query', 10, 2 );
m
mehdi bayati
Exactly I need this feature. I think that a lot of Woodmart users need this feature, but they don't know it! If they knew the effect of this on the sale of their site, it would not be possible for this post to have so many votes!
R
Razvan Lica
I've got a code from the Support team, to do that. Is manual, but it works. CHeck the forum
R
Razvan Lica
DEfinetly something usefull for me as well
R
Rafael Sartori
Another amazing tool. Today we need to use plugins or snippets to do that and is not perfect.