How to Edit the Add to Cart Text by Product Category in WooCommerce

How to Edit the Add to Cart Text by Product Category in WooCommerce
On this page
  1. Why Customize Add to Cart Text per Category
  2. Step 1: Filter the Button Text by Category
  3. Troubleshooting
  4. Frequently Asked Questions
  5. Conclusion

You can edit the Add to Cart text by product category in WooCommerce by filtering the button text and checking the product’s assigned category before returning a custom label, letting different categories use different call-to-action wording.

Why Customize Add to Cart Text per Category

  • Digital or service-based categories may read better with “Book Now” or “Get Access” instead of “Add to Cart”
  • Pre-order categories benefit from clearer wording like “Reserve Yours” instead of the default label
  • Different product types often convert better with category-specific calls to action

Step 1: Filter the Button Text by Category

PHP
/**
 * Change the Add to Cart button text based on product category
 * Add to your child theme's functions.php
 */
add_filter( 'woocommerce_product_add_to_cart_text', 'customize_add_to_cart_text_by_category', 10, 2 );

function customize_add_to_cart_text_by_category( $text, $product ) {
    if ( has_term( 'digital-downloads', 'product_cat', $product->get_id() ) ) {
        return 'Get Instant Access';
    }
    if ( has_term( 'pre-order', 'product_cat', $product->get_id() ) ) {
        return 'Reserve Yours';
    }
    return $text;
}

Variant: Apply the Same Change on the Single Product Page

PHP
add_filter( 'woocommerce_product_single_add_to_cart_text', 'customize_single_add_to_cart_text_by_category', 10, 2 );

function customize_single_add_to_cart_text_by_category( $text, $product ) {
    if ( has_term( 'digital-downloads', 'product_cat', $product->get_id() ) ) {
        return 'Get Instant Access';
    }
    return $text;
}
Edit the add to cart text by product category in WooCommerce: the page before adding the code
Before
Edit the add to cart text by product category in WooCommerce: the page after adding the code
After

Troubleshooting

The Text Changes on the Shop Page but Not the Single Product Page

These are two separate filters — woocommerce_product_add_to_cart_text affects loop/archive buttons, while woocommerce_product_single_add_to_cart_text affects the single product page button. Add both if you want consistent wording everywhere.

Variable Products Don’t Reflect the Change Correctly

Variable products may use a slightly different flow (the button often reads “Select Options” until a variation is chosen). Test on a variation-selected state specifically, since the initial button text follows separate logic.

Frequently Asked Questions

Can I set different text for more than two categories?

Yes, add more has_term() conditionals inside the function, each returning its own custom text for a different category slug.

Does this affect the “Select Options” text on variable products?

No, that specific button label is generated by a different WooCommerce filter — target woocommerce_product_add_to_cart_text with a type check if you also want to customize that state.

Will this work with the
shortcode?

Yes, since the shortcode renders products through the same loop template, the button text filter applies there as well.

Conclusion

A category check inside the add-to-cart text filter is all it takes to edit the Add to Cart text by product category in WooCommerce, whether for a shop-wide loop or the single product page. Add both filters shown above if you want the custom wording to stay consistent across every product display.

See also How to Edit the In Stock Quantity Text on the WooCommerce Product Page.

Prefer no code? All-in-One Utilities Woo Add-on handles this kind of change from a settings screen. Its Add to cart text and prices guide also shows how.

Leave a Reply

Schedule a call