A custom Add to Cart button in WooCommerce is one you edit through code, a plugin, or the block editor to change its text, color, icon, or destination instead of using the plain default button. You can have one working in under ten minutes.
The default button says “Add to Cart” and nothing else. Fine for a generic store. Not so fine if you sell courses, pre-orders, or anything where “Add to Cart” doesn’t match what the customer is actually doing.
This guide walks through the editing the template file, using hooks and filters, installing a plugin, and working inside the block editor. Pick the one that fits your comfort with code, then follow the steps below.
Why Customize the Add to Cart Button?

Three real reasons, not marketing fluff.
- It matches the action: “Book Course” makes more sense than “Add to Cart” for an online class. “Pre-order” tells the customer exactly what they’re getting into. Words matter more than people think.
- It matches your brand: A neon green button on a minimalist beauty store looks wrong. Color and shape should feel like part of the same site, not a plugin default added awkwardly.
- It can lift conversions: Not guaranteed. But a clearer label and a button that stands out from the page background usually helps more than it hurts. Small changes like this are part of a wider eCommerce user experience strategy, not a fix on their own.
Worth knowing before you start: The Add to Cart button on a product page is different from a custom button placed on the cart page itself, like a “continue shopping” or “apply coupon” button. If that’s what you’re after instead, the process for a custom button on the cart page is a separate guide.
Method 1: Edit the Template File
This gives you the most control. It also carries the most risk if you skip the setup step.
Never edit WooCommerce’s core template files directly. An update will wipe your changes without warning, and there’s no way to get them back afterward. You need a child theme first. You can confirm the current template structure in the official WooCommerce code reference before you start.
Here’s the process:
- Create a child theme (or activate one you already have).

- Find the file at
woocommerce/templates/single-product/add-to-cart/simple.php.
- Copy it into your child theme, keeping the same folder path:
yourtheme-child/woocommerce/single-product/add-to-cart/simple.php.
- Open the copied file and edit the HTML around the button.

A basic edit to add an icon before the button text looks like this:
<button type="submit" name="add-to-cart" value="<?php echo esc_attr( $product->get_id() ); ?>" class="single_add_to_cart_button button alt">
<?php echo esc_html( $product->add_to_cart_text() ); ?>
</button>
Change the text inside the <button> tag, or wrap it with your own markup. Save the file, clear any cache, and check the product page.
Limitation: This method only works for simple products out of the box. Variable and grouped products use different template files, so you’d need to repeat the process for each one separately.
Method 2: Use Hooks and Filters
This is the method most WooCommerce developers reach for first. No template files touched, so nothing breaks when WooCommerce updates.
To change the button text on a single product page:
- Go to Appearance → Theme File Editor.

- Then Go to
functions.phpin your child theme.
- Add this at the bottom of the file:
add_filter( 'woocommerce_product_single_add_to_cart_text', 'custom_cart_button_text' );
function custom_cart_button_text() {
return __( 'Buy Now', 'woocommerce' );
}
- Save. Refresh the product page.

To change the text on shop and category pages too, use a second filter:
add_filter( 'woocommerce_product_add_to_cart_text', 'custom_cart_button_text_archive' );
function custom_cart_button_text_archive() {
return __( 'Buy Now', 'woocommerce' );
}
Both snippets go in the same functions.php file. You can run different text on each page type, or the same text everywhere. Your call.
Want different text for different products? Wrap the return statement in a conditional check against the product ID or category, and return a different text depending on which one matches. This is also the cleanest way to handle a store that sells a mix of physical goods and pre-orders side by side, without switching plugins for each product type.
Method 3: Use a Free Plugin for a Custom Add to Cart Button in WooCommerce
If code makes you nervous, a plugin gets you most of the same result through a settings screen instead of a functions file.
- Go to Plugins → Add Plugin in your WordPress dashboard.

- Install and Activate Custom Add to Cart Button Label and Link for WooCommerce from WordPress plugin directory.

- Go to Appearance → Customize.

- Inside Customize Tab, WooCommerce → Cart.

- Set your button text, color, and icon in the live preview panel.

- Click Publish.

Most tutorials skip the icon step entirely, or assume you already have an icon library loaded. Don’t assume Font Awesome is on your site. Check first. If it isn’t there, use the plugin’s built-in icon picker instead of hardcoding an icon class that quietly won’t render.
Method 4: Style the Button with CSS
Text is one thing. Color and shape are another. Neither of the first two methods touches how the button actually looks on the page.
Go to Appearance → Customize → Additional CSS and add:
.single_add_to_cart_button {
background-color: #2ecc71;
color: #ffffff;
border-radius: 4px;
padding: 12px 24px;
}
These styles the button on the single product page. For the button on shop and category pages, target a different class:
.add_to_cart_button.button {
background-color: #2ecc71;
color: #ffffff;
border-radius: 4px;
}
Swap in your own colors and spacing. Publish, then check both page types, since they use separate classes and one change won’t automatically carry over to the other.
Add an Add to Cart Button Anywhere with a Shortcode
Sometimes you want a buy button outside the shop entirely, inside a blog post or a landing page. WooCommerce has a built-in shortcode for exactly that.
- Find the product ID under Products → All Products (it shows below the product name on hover).

- Add this shortcode wherever you want the button to appear:
[add_to_cart id="123"]![Add this shortcode wherever you want the button to appear: [add_to_cart id="123"]](https://devdiggers.com/wp-content/uploads/2026/08/product-custom-button-settings-shortcode-editor.webp)
- Replace 123 with your actual product ID(Obtain Product id from the URL of the product).

Drop it into a page, a post, or a widget. It renders the full working button, price included, wherever you place it. No separate setup needed beyond having the right product ID.
Skip the Cart Page and Go Straight to Checkout
Every extra click between “Add to Cart” and payment is a chance for someone to abandon the order. If you sell one or two products, or you’re running a single-product landing page, sending the customer straight to checkout can cut that extra effort down.
You don’t need a paid plugin for this. Add the filter below to functions.php:
add_filter( 'woocommerce_add_to_cart_redirect', 'redirect_to_checkout' );
function redirect_to_checkout() {
return wc_get_checkout_url();
}
This sends every add-to-cart click straight to checkout, skipping the cart page entirely. Fine for single-product stores. Not ideal if your customers regularly buy more than one item per order, since they’ll land on checkout before they’ve finished browsing the rest of your catalog(product list).
Editing the Button on a Block Theme
If your theme uses the WordPress block editor and you’re running WooCommerce 8.3 or later, the template-file method above may not apply the way you expect.
Block themes render the Cart and Checkout as blocks, not classic PHP templates, and the file path from Method 1 may not even exist in your setup. WooCommerce’s own store editing documentation covers how these blocks work if you want the full picture.
Here’s what to do instead:
- Go to Appearance → Editor.

- Open the single product template.

- Click directly on the Add to Cart block to Customize the button.

Deep styling control is still limited here compared to CSS or a dedicated plugin. For anything beyond color and text, the CSS method from Method 4 still works on block themes, since it targets the same basic class names regardless of which template system renders the page.
Fixing Common Problems
- Button text isn’t changing: Clear your page cache and any object cache plugin. The filter only affects new page loads, not cached ones already saved before you made the change.
- Custom CSS isn’t applying: Open your browser’s dev tools and inspect the button directly. Check whether your theme or another plugin is loading a more specific CSS rule that’s quietly replacing yours.
- Changes vanished after a WooCommerce update: This only happens if you edited the original template file directly instead of copying it to a child theme first. There’s no way to recover those changes once they’re gone. Set up the child theme now to stop it happening again.
If none of this feels worth the afternoon it takes to debug, our WooCommerce development services team handles this kind of customization directly, along with anything more involved than a single button.
Conclusion
A custom Add to Cart button in WooCommerce comes down to four methods, each suitable to a different skill level. Template file editing gives full control but needs a child theme and comfort with PHP.
Hooks and filters are the safest middle ground for text changes. A plugin works if you want zero code touched at all. And if you’re on a block theme, the block editor handles the basics without opening a single PHP file.
Start with the method that matches your current setup, not the one that sounds most impressive. A working “Buy Now” button today beats a perfect custom template you never get around to finishing.
Frequently Asked Questions (FAQs)
Q1. Will my changes disappear after a WooCommerce update?
Only if you edited the original template file directly. Changes made through a child theme, hooks and filters, or a plugin survive updates without issue.
Q2. Can I redirect the button to a custom page, like a bank transfer or payment form?
Yes. The woocommerce_add_to_cart_redirect filter used earlier in this guide can point to any URL, not just the checkout page. Swap wc_get_checkout_url() for your own URL string.
Q3. Do I need a child theme to change the button?
Only for Method 1, editing the template file. Hooks and filters, plugins, and the block editor all work without one, since none of them touch core files.
Q4. Why isn’t my new button text showing up on the site?
Almost always a caching issue. Clear both your page cache and any object cache, then reload the page in a private browser window to rule out browser cache too.
Q5. Can I use different button text for different products?
Yes. Wrap your filter function in a conditional that checks the product ID, category, or product type, and return different text depending on which one matches.
Q6. Will this work if I sell variable products, like a T-shirt with size options?
The hooks and filters method (Method 2) works the same way regardless of product type. Template file overrides (Method 1) need a separate file for variable products, since WooCommerce renders them differently from simple products.
