Tagged: woocommerce
Hello, everyone,
I use Enfold and WC and have a question.
I built my shop page via Enfold using the “Product List” from WC.
How can I not hide the “Out of Stock article” completely, but instead show it grayed out and not clickable?
Hallo zusammen,
ich nutze Enfold und WC und habe eine Frage.
Ich habe meine Shopseite über Enfold mit der “Produkt-Liste” aus WC gebaut.
Wie kann ich den “Out of Stock-Artikel” nicht ganz ausblenden, sondern z.B. ausgegraut und nicht anklickbar darstellen?
Hey fredirain,
Thank you for the inquiry.
You can try this filter in the functions.php file.
/**
* @snippet Sort Products By Stock Status - WooCommerce Shop
* @how-to Get CustomizeWoo.com FREE
* @author Rodolfo Melogli
* @compatible WooCommerce 3.9
* @donate $9 https://businessbloomer.com/bloomer-armada/
*/
add_filter( 'woocommerce_get_catalog_ordering_args', 'bbloomer_first_sort_by_stock_amount', 9999 );
function bbloomer_first_sort_by_stock_amount( $args ) {
$args['orderby'] = 'meta_value';
$args['order'] = 'ASC';
$args['meta_key'] = '_stock_status';
return $args;
}
This will display out of stock items at the end of the grid.
Based on: https://stackoverflow.com/questions/25113581/show-out-of-stock-products-at-the-end-in-woocommerce
Best regards,
Ismael