Skip to content

Instantly share code, notes, and snippets.

@SiR-DanieL SiR-DanieL/functions.php
Last active Mar 3, 2016

Embed
What would you like to do?
add_filter( 'woocommerce_product_single_add_to_cart_text', 'funzione_cat_add_to_cart_text', 10, 2 );
function funzione_cat_add_to_cart_text( $default, $product ) {
$terms = get_the_terms( $product->id, 'product_cat' );
foreach ( $terms as $term ) {
if ( $term->name == 'Posters' ) {
$default = __( 'Custom Text', 'domain' );
break;
}
}
return $default;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.