How to Rename the Buy Product Label for External Products in WooCommerce

How to Rename the Buy Product Label for External Products in WooCommerce
On this page
  1. Why Override the Label in Code
  2. Step 1: Override the Label Globally
  3. Troubleshooting
  4. Frequently Asked Questions
  5. Conclusion

You can rename the Buy Product label for external products in WooCommerce site-wide with two filters — woocommerce_product_single_add_to_cart_text and woocommerce_product_add_to_cart_text — instead of manually editing the button text on every product.

Why Override the Label in Code

  • WooCommerce lets you rename this button per-product, but that doesn’t scale across hundreds or thousands of affiliate listings
  • A consistent, on-brand call-to-action (“Buy Now”, “Get It Here”, “Shop at Retailer”) reads better than the generic default
  • One snippet updates every existing and future external product automatically

Step 1: Override the Label Globally

PHP
/** Rename the "Buy Product" button label for all external/affiliate products */
add_filter( 'woocommerce_product_single_add_to_cart_text', 'rename_external_product_button_label', 9999, 2 );
add_filter( 'woocommerce_product_add_to_cart_text', 'rename_external_product_button_label', 9999, 2 );

function rename_external_product_button_label( $text, $product ) {
    if ( $product->is_type( 'external' ) ) {
        $text = 'Shop at Retailer →';
    }
    return $text;
}
Rename the buy product label for external products in WooCommerce: the page before adding the code
Before
Rename the buy product label for external products in WooCommerce: the page after adding the code
After

Using a Different Label Per Category

PHP
add_filter( 'woocommerce_product_single_add_to_cart_text', 'rename_external_button_by_category', 9999, 2 );
add_filter( 'woocommerce_product_add_to_cart_text', 'rename_external_button_by_category', 9999, 2 );

function rename_external_button_by_category( $text, $product ) {
    if ( ! $product->is_type( 'external' ) ) {
        return $text;
    }

    if ( has_term( 'partner-stores', 'product_cat', $product->get_id() ) ) {
        return 'Visit Partner Store →';
    }

    return 'Shop at Retailer →';
}

Troubleshooting

Label Doesn’t Change on the Shop Page

Make sure both filters are added — woocommerce_product_add_to_cart_text covers the shop/archive grid buttons, while woocommerce_product_single_add_to_cart_text covers the single product page. Missing either one leaves the default label on that specific view.

Manually Set Product-Level Labels Get Overwritten

Since this filter runs with a high priority, it overrides individually configured button text too. If you want per-product overrides to take precedence, check $product->get_button_text() inside the callback and only apply the default when that field is empty.

Frequently Asked Questions

Does this affect simple or variable product buttons?

No, the is_type( 'external' ) check restricts the change strictly to external/affiliate products.

Can I use an icon or emoji in the label?

Yes, since it’s just a string, you can include an arrow entity, emoji, or any plain text/HTML entity supported by the button markup.

Will this affect the “Buy Product” text used in order emails?

No, external products don’t generate a cart/order line item the way regular products do, so this only affects the front-end button.

Conclusion

Renaming the Buy Product label for external products in WooCommerce with two filters avoids editing every product by hand. It’s a fast, scalable fix for affiliate-heavy catalogs that want consistent, on-brand call-to-action text.

See also How to Count External Product Clicks in WooCommerce. Then read How to Display Stock Status for External Products in WooCommerce.

Prefer no code? All-in-One Utilities Woo Add-on adds over 50 WooCommerce features, so you can switch them on without code.

Leave a Reply

Schedule a call