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

Question

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

0
, Arwahi M 2 years 2019-12-24T06:22:11-05:00 0 Answers 81 views 0

Leave an answer

Browse
Browse