Created
May 6, 2021 13:37
-
-
Save jamesckemp/baa74dadd2e6e1648d38e2cdaccc04d6 to your computer and use it in GitHub Desktop.
Change the variable product button text in WooCommerce
This file contains 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
<?php | |
/** | |
* Change variable product text. | |
* | |
* [link to article] | |
* | |
* @param string $button_text | |
* @param WC_Product $product | |
* | |
* @return string|void | |
*/ | |
function iconic_change_variable_product_button_text ( $button_text, $product ) { | |
if ( ! $product->is_type( 'variable' ) ) { | |
return $button_text; | |
} | |
return __( 'View Product', 'iconic' ); | |
} | |
add_filter( 'woocommerce_product_add_to_cart_text', 'iconic_change_variable_product_button_text', 10, 2 ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment