Skip to content

Instantly share code, notes, and snippets.

@scgoeswild
Last active November 12, 2020 11:24
Show Gist options
  • Save scgoeswild/bc48b7f44949c9d50cf2453087fdaad2 to your computer and use it in GitHub Desktop.
Save scgoeswild/bc48b7f44949c9d50cf2453087fdaad2 to your computer and use it in GitHub Desktop.
Change the Add To Cart Link and Text on WooCommerce Archive Page
<?php
//* Change Add To Cart to Select Options
//add_filter( 'woocommerce_product_add_to_cart_text' , 'sfws_woocommerce_product_add_to_cart_text' );
function sfws_woocommerce_product_add_to_cart_text() {
global $product;
$product_type = $product->product_type;
switch ( $product_type ) {
case 'external':
return __( 'Buy product', 'woocommerce' );
break;
case 'grouped':
return __( 'View products', 'woocommerce' );
break;
case 'simple':
return __( 'Select Options', 'woocommerce' );
break;
case 'variable':
return __( 'Select options', 'woocommerce' );
break;
default:
return __( 'Read more', 'woocommerce' );
}
}
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment