Out of Stock Message
-
Hello! I have a question.
On this product: https://www.rebento.pt/loja/mae/almofada-carocos-cereja
I have three variations (3 different colors). Only one (“Creme”) is available. I want that if the client selects one of the colors that are out of stock, a message appears (like the one saying “disponível!” for the available color).I have this function in my functions.php but the entry for the “out of stock” (Esgotado) message doesn’t work:
add_filter( 'woocommerce_get_availability', 'wcs_custom_get_availability', 1, 2); function wcs_custom_get_availability( $availability, $_product ) { // Change In Stock Text if ( $_product->is_in_stock() ) { $availability['availability'] = __('Disponível!', 'woocommerce'); } // Change Out of Stock Text if ( ! $_product->is_in_stock() ) { $availability['availability'] = __('Esgotado', 'woocommerce'); } return $availability; }
Am I doing something wrong?
Thanks in advance for any help!
Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
- The topic ‘Out of Stock Message’ is closed to new replies.