-
-
Save ntccloud/db5fe7fa88dbd1cf5379bf7f10c824d6 to your computer and use it in GitHub Desktop.
How to change ‘select options’ ‘add to cart’ button text in WooCommerce
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
add_filter( 'woocommerce_product_add_to_cart_text' , 'custom_select_options_text' ); | |
function custom_select_options_text() { | |
global $product; | |
$product_type = $product->product_type; | |
switch ( $product_type ) { | |
case 'subscription': | |
return __( 'Options', 'woocommerce' ); /*change 'Options' for Simple Subscriptions */ | |
case 'variable-subscription': | |
return __( 'Options', 'woocommerce' ); /*change 'Options' for Variable Subscriptions */ | |
case 'variable': | |
return __( 'Options', 'woocommerce' ); /*change 'Options' for Variable Products */ | |
case 'simple': | |
return __( 'Add to Cart', 'woocommerce' ); /*change 'Add to Cart' for Simple Products */ | |
break; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment