Skip to content

Instantly share code, notes, and snippets.

@dr5hn
Created October 15, 2017 08:47
Show Gist options
  • Save dr5hn/05b55d947ca86bf34dbfe462327f7033 to your computer and use it in GitHub Desktop.
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
<?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