Created
October 15, 2017 08:47
-
-
Save dr5hn/05b55d947ca86bf34dbfe462327f7033 to your computer and use it in GitHub Desktop.
How to Update Add to Cart and Select Options Button Text on Shop Archive Page 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 | |
// Updating Select Options and Add to Cart Button Text on Shop Archive Page -- By Darshan Gada | |
add_filter( 'woocommerce_product_add_to_cart_text' , 'woo_custom_view_button_text' ); | |
function woo_custom_view_button_text() { | |
global $product; | |
$product_type = $product->get_type(); | |
switch ($product_type) { | |
case 'variable': | |
return __( 'VIEW PRODUCT', 'woocommerce' ); //this will change "Select Options" to "View Product" | |
break; | |
default: | |
return __( 'ADD TO BASKET', 'woocommerce' ); //this will change "Add to Cart" to "Add to Basket" | |
} | |
} | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment