Change Product ‘add to cart’ button text based on category

add_filter( 'woocommerce_product_single_add_to_cart_text', 'product_single_add_to_cart_button_text', 20, 1 );
function product_single_add_to_cart_button_text( $text ) {
    if( has_term( array('donate'), 'product_cat' ) )
    $text = __('donate', 'woocommerce');
    return $text;
}
No Comments

Sorry, the comment form is closed at this time.