about out of stock and no price product on product listing
-
Dear Support
My i ask if any setting can make the no price and out of stock product display at last in the product list ?
Thank
Mango
Hello,
Try to remove the product price and in the inventory tab remove check the option out of stock. And you will see this product out of stock in product listings.
Best Regards.
Thank for your quick reply ,
they can showon listing , but they want to show it at the last of the listing when the product is no stock , is it possible ?
Hello,
Try to add the below code to the functions.php file in your child theme.
add_filter('posts_clauses', 'order_by_stock_status'); 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; }
Best Regards.
Dear support ,
when it add to child theme, function.php . the site can’t load with wordpress serious problem warning
Any idea what wrong with it ?
thank
Mango
Hello,
Can you please share the WP admin login details of your site and FTP login details so I will check what is happening after add the code.
Also, share the screenshot of the issue or warning you see after add the code in the child theme.
Best Regards.