Skip to content

Instantly share code, notes, and snippets.

@agronom81
Last active July 5, 2018 11:18
Show Gist options
  • Save agronom81/1eecd7c7148f186a024a1c1057c47398 to your computer and use it in GitHub Desktop.
Save agronom81/1eecd7c7148f186a024a1c1057c47398 to your computer and use it in GitHub Desktop.
Change the Add to Cart text in WooCommerce
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