Skip to content

Instantly share code, notes, and snippets.

@sudarshann
Created August 7, 2020 12:10
Show Gist options
  • Save sudarshann/378c659d79905602dc38564592938b6b to your computer and use it in GitHub Desktop.
Save sudarshann/378c659d79905602dc38564592938b6b to your computer and use it in GitHub Desktop.
Custom woocommerce out of stock message
add_filter( 'woocommerce_product_add_to_cart_text', 'superbotics_add_to_cart_text', 20, 2);
add_filter( 'woocommerce_product_single_add_to_cart_text', 'superbotics_add_to_cart_text', 20, 2);
function superbotics_add_to_cart_text( $text, $_product ) {
if ( ! $_product->is_in_stock() ) {
$text = __('<Custom Text>', 'superbotics-customizations');
}
return $text;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment