Skip to content

Instantly share code, notes, and snippets.

@lukecav
Last active April 14, 2022 12:52
Show Gist options
  • Save lukecav/491ed0618c42a208ceb56ed95155179a to your computer and use it in GitHub Desktop.
Save lukecav/491ed0618c42a208ceb56ed95155179a to your computer and use it in GitHub Desktop.
How to change ‘select options’ ‘add to cart’ button text in WooCommerce
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;
}
}
@maxwellnorman
Copy link

Works smoothly. Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment