Last active
October 30, 2023 07:43
-
-
Save SirDarcanos/88033754a1e5dc7ec91db617e4a6ba5c to your computer and use it in GitHub Desktop.
Change the Out of stock string based on the product's cost
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
add_filter( 'woocommerce_get_availability_text', 'price_out_of_stock_string', 10, 2 ); | |
function price_out_of_stock_string( $text, $product ) { | |
if ( $text === 'Out of stock' && $product->get_price() < 100 ) { | |
return "Out of stock because of The Queen's Gambit"; | |
} | |
return $text; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment