Last active
July 5, 2018 11:18
-
-
Save agronom81/1eecd7c7148f186a024a1c1057c47398 to your computer and use it in GitHub Desktop.
Change the Add to Cart text in WooCommerce
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' ); | |
function custom_woocommerce_product_add_to_cart_text() { | |
global $product; | |
$product_type = $product->get_type(); | |
switch ( $product_type ) { | |
case 'external': | |
return __( 'Take me to their site!', 'woocommerce' ); | |
break; | |
case 'grouped': | |
return __( 'VIEW THE GOOD STUFF', 'woocommerce' ); | |
break; | |
case 'simple': | |
return __( 'WANT. NEED. ADD!', 'woocommerce' ); | |
break; | |
case 'variable': | |
return __( 'Select the variations, yo!', '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