Created
June 24, 2020 10:08
-
-
Save webdados/ef12c6e0e6939c6c593e2020463d72c0 to your computer and use it in GitHub Desktop.
Change WooCommerce add to cart text for products on backorder
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_product_add_to_cart_text', 'my_woocommerce_product_add_to_cart_text', 10, 2 ); | |
add_filter( 'woocommerce_product_single_add_to_cart_text', 'my_woocommerce_product_add_to_cart_text', 10, 2 ); | |
function my_woocommerce_product_add_to_cart_text( $text, $product ) { | |
if ( $product->is_on_backorder() ) { | |
return 'Reservar'; | |
} | |
return $text; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment