• Right so the scene!

    Would like a different text to appear on the add to cart button.

    If is in category ‘Donation’ use custom text of donation
    But for the rest of the products display other custom text “Add”

    This is my code so far,

    add_filter( 'add_to_cart_text', 'woo_custom_cart_button_text' );                                // < 2.1
    add_filter( 'woocommerce_product_single_add_to_cart_text', 'woo_custom_cart_button_text' );    // 2.1 +
    
    function woo_custom_cart_button_text() {
    	if(is_product_category('Donation')) {
    	return __('Donate', 'woocommerce' );
      } else {
    	  return __('Add', 'woocommerce' );
      }
    }

    [ No bumping please. ]

  • The topic ‘WooCommerce Different text for add to cart depending on product category’ is closed to new replies.