php - Changing the Add To Cart button text in WooCommerce for items with variations -
i'm running woocommerce version 2.5.5. following lines of code don't seem change add cart button text on product page item variations:
add_filter('variable_add_to_cart_text', 'my_custom_cart_button_text'); function my_custom_cart_button_text() { return __('buy now', 'woocommerce'); }
would happen know i'm missing?
the correct filter single product page woocommerce_product_single_add_to_cart_text
.
function my_custom_cart_button_text( $text, $product ) { if( $product->is_type( 'variable' ) ){ $text = __('buy now', 'woocommerce'); } return $text; } add_filter( 'woocommerce_product_single_add_to_cart_text', 'my_custom_cart_button_text', 10, 2 );
Comments
Post a Comment