Last active
April 14, 2022 12:52
-
-
Save lukecav/491ed0618c42a208ceb56ed95155179a 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
Works smoothly. Thanks!