Created
March 27, 2018 22:03
-
-
Save kabbo508/af30bed06efef27850c9a2f7b470e907 to your computer and use it in GitHub Desktop.
Please put this Script at the your Child Theme function.php file before the " } " symbol at the bottom.
This file contains 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
add_filter( 'woocommerce_product_add_to_cart_text' , 'custom_woocommerce_product_add_to_cart_text' ); | |
/** | |
* custom_woocommerce_template_loop_add_to_cart | |
*/ | |
function custom_woocommerce_product_add_to_cart_text() { | |
global $product; | |
$product_type = $product->product_type; | |
switch ( $product_type ) { | |
case 'external': | |
return __( 'Buy product', 'woocommerce' ); | |
break; | |
case 'grouped': | |
return __( 'View products', 'woocommerce' ); | |
break; | |
case 'simple': | |
return __( 'Add to cart', 'woocommerce' ); | |
break; | |
case 'variable': | |
return __( 'Custom text', 'woocommerce' ); | |
break; | |
default: | |
return __( 'Read more', 'woocommerce' ); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment