Hello
1. I wanted to setup my store so the out the stock products show last on my product list I used custom code which works but when i select sort by price or anything else the “out of stock” products are not affected , do you have any tips how can i improve my code?
‘// In-stock product show first on webshop
add_filter(‘posts_clauses’, ‘custom_order_by_stock_status’, 2000);
function custom_order_by_stock_status($posts_clauses) {
global $wpdb;
if (is_woocommerce() && (is_shop() || is_product_category() || is_product_tag())) {
$posts_clauses[‘join’] .=
” INNER JOIN {$wpdb->postmeta} istock ON ({$wpdb->posts}.ID = istock.post_id)”;
$posts_clauses[‘where’] .=
” AND istock.meta_key = ‘_stock_status’ AND istock.meta_value <> ””;
// ‘instock’ sorts before ‘outofstock’ alphabetically
$posts_clauses[‘orderby’] =
” istock.meta_value ASC, ” . $posts_clauses[‘orderby’];
}
return $posts_clauses;
}’
2. Question : Everytime i add product to cart a popup shows up with list what products i have, how can i disable it? and only show when I click on show cart icon? (attached img. add to cart popup)
3. Question: On product catalog page the add to cart button is not alined with other products add to cart button due the different lenght of product name, how can I set it up so the grid is perfectly simetric? (attached image uneven product height)