Skip to content

Instantly share code, notes, and snippets.

@ntccloud
Forked from lukecav/functions.php
Created February 16, 2022 05:01
Show Gist options
  • Save ntccloud/db5fe7fa88dbd1cf5379bf7f10c824d6 to your computer and use it in GitHub Desktop.
Save ntccloud/db5fe7fa88dbd1cf5379bf7f10c824d6 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;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment