after the product is out of stock, the buttons added to the cart are hidden and replaced with special texts, for example “expired”

Wordpress

is there someone there who can help me?

I added this code in the theme functions.php

if (!function_exists('woocommerce_template_loop_add_to_cart')) {
    function woocommerce_template_loop_add_to_cart() {
        global $product;
        if ( ! $product->is_in_stock() || ! $product->is_purchasable() ) return;
        woocommerce_get_template('loop/add-to-cart.php');
    }
}

so my out of stock products will hide the add to basket button,

and this works well

but I want to replace it, after the product is out of stock, the buttons added to the cart are hidden and replaced with special texts, for example “expired”

How to do it

Thank you very much

Share:

Post a Comment

Designed by OddThemes | Distributed by Blogger Themes