Add a Continue Shopping Button in WooCommerce (No Plugin)

A shopper reaches your cart, checks the total, and then wants one more item. If the only clear button points to checkout, many people leave the cart and hunt for the shop link in the menu. This guide shows you how to add continue shopping button WooCommerce without plugin support, with three methods that cover both modern and classic cart setups.
The right method depends on one check. Newer stores usually use the Cart block, while older stores use the classic shortcode cart. The two accept changes in different places, so a snippet that works on one can do nothing on the other. This tutorial explains that difference, then gives you a no code route, a classic route, and a checkout variant.
Why Does the Cart Need a Continue Shopping Button?
The cart page has two jobs. It confirms what the shopper picked, and it helps the shopper decide the next step. Checkout is one next step, but it is not the only one. A shopper may want a matching product, a second size, or a gift for someone else. Without a visible way back to the shop, that intention turns into extra taps or a closed tab.
Keep checkout visually stronger. Continue shopping should look secondary, often an outline button. That hierarchy guides ready buyers forward while giving browsers an obvious path back.
Is Your Cart the Cart Block or the Classic Shortcode Cart?
Check this before you touch any code. In your WordPress dashboard, open Pages and edit the Cart page. If you see blocks such as Cart items and Cart totals inside a Cart block, your store uses the block cart. If you see a single shortcode, [woocommerce_cart], your store uses the classic cart. Write down which one you have, because the methods below split along that line.
The block cart is built with React components and block templates. Classic cart hooks such as woocommerce_after_cart_totals belong to the classic template system, so they may never fire on a block cart page. That is why many copied snippets appear to do nothing. The snippet is not always wrong. It is simply attached to a cart your store no longer renders.
- Cart block present: use Method 1 and edit the Cart page in the block editor.
- Shortcode cart present: use Method 2 and add PHP through a child theme or Code Snippets.
- Not sure: view the Cart page editor and look for block names before choosing.
- Custom cart template: ask your theme docs which hooks or blocks it supports.
Open your cart logged out in a private window too. Some themes replace the standard cart entirely, so confirm which system renders the page. The WooCommerce developer docs describe the block based cart in detail.
Method 1: How Do You Add the Button Under the Cart Block?
This method needs no code. It adds a Buttons block under the Cart block, linking to your shop page. Because the change lives in page content, theme updates do not erase it.
- Go to Pages, open the Cart page, and click the Cart block once to select its outer wrapper.
- Press Enter or use the block inserter to add a Buttons block below the Cart block.
- Type Continue shopping as the button text and link it to your Shop page URL.
- Choose the outline style if your theme offers one, so checkout stays the stronger action.
- Align the button with the cart content width, then preview on desktop and mobile.
- Update the page, add a product to the cart, and click the new button to confirm the link.
Pick the Shop page from the link picker rather than pasting a hard coded path, so the URL stays correct if the site moves. Save and test while logged out, because admins sometimes see cached states.
Know the limit of this method. The Buttons block sits outside the Cart block, so it renders even when the cart is empty. An empty cart already shows a Return to shop button from WooCommerce itself, which means two similar buttons can appear together. Many stores accept that, but if the duplication bothers you, use the classic method on a shortcode cart or accept the trade off on the block cart.
Method 2: How Do You Add the Button to the Classic Cart With PHP?
Use this method when your Cart page holds the [woocommerce_cart] shortcode. The classic cart fires the woocommerce_after_cart_totals action after the totals box, which is a natural home for the button. Add the snippet to your child theme functions.php file or to the Code Snippets plugin set to run on the front end only. Never edit WooCommerce template files directly, because plugin updates overwrite them.
add_action('woocommerce_after_cart_totals', 'vutg_continue_shopping_button');
function vutg_continue_shopping_button() {
if (WC()->cart->is_empty()) {
return;
}
$shop_url = wc_get_page_permalink('shop');
if (!$shop_url) {
$shop_url = home_url('/shop/');
}
echo '<p class="vutg-continue-wrap">';
echo '<a class="button vutg-continue-shopping" href="' . esc_url($shop_url) . '">';
echo esc_html__('Continue shopping', 'vutg');
echo '</a></p>';
}
The empty cart check returns early, so the button never duplicates the Return to shop button. wc_get_page_permalink asks WooCommerce for the real shop URL, respecting page settings and translations. esc_url and esc_html__ keep output safe and translatable.
Test at once. Add a product and confirm the button appears once, empty the cart and confirm it disappears, then repeat in a private window. If nothing appears, recheck whether your cart is really the shortcode cart.
Method 3: Should You Add the Button on the Checkout Page Too?
Some stores add the link on checkout for shoppers who forgot an item. Treat it as optional. Checkout is a focused page, and every extra exit can cost an order. If you add it, keep it small and above the form.
add_action('woocommerce_before_checkout_form', 'vutg_checkout_continue_link');
function vutg_checkout_continue_link() {
if (WC()->cart->is_empty()) {
return;
}
$shop_url = wc_get_page_permalink('shop');
if (!$shop_url) {
return;
}
echo '<p class="vutg-checkout-continue">';
echo '<a href="' . esc_url($shop_url) . '">';
echo esc_html__('Forgot something? Continue shopping', 'vutg');
echo '</a></p>';
}
The woocommerce_before_checkout_form hook belongs to the classic checkout. On the Checkout block, classic hooks may not run, so add a small paragraph link above the block instead. A quiet text link beats a full button here. If orders dip, remove it and keep the button on the cart only.
How Do You Style the Button Without Breaking the Layout?
Start from your theme button style so the new button feels native. The classic snippet already adds the button class, which most themes style automatically. Add a small custom class rule only for spacing and width. Put CSS in the Customizer additional CSS panel or your child theme stylesheet, never in a parent theme file.
.vutg-continue-wrap {
margin-top: 16px;
text-align: right;
}
.vutg-continue-shopping {
display: inline-block;
padding: 12px 20px;
border: 2px solid currentColor;
border-radius: 6px;
text-decoration: none;
}
@media (max-width: 767px) {
.vutg-continue-wrap {
text-align: center;
}
.vutg-continue-shopping {
display: block;
width: 100%;
box-sizing: border-box;
text-align: center;
}
}
The mobile rule matters. On narrow screens a full width button is easy to tap and never crowds the totals. Keep the tap target at least 44 pixels tall, keep text readable, and check that the button never overlaps the coupon field or the update cart control. While you refine the cart, our guide to customize the WooCommerce My Account page without a plugin shows the same safe editing habits for account screens.
Can the Button Link to a Category Instead of the Shop?
Yes, and sometimes it should. A store may send shoppers to a best sellers category, or to a sale category during a campaign. Match the label to the destination, so View best sellers beats Continue shopping for a curated list. Review the link after campaigns end, so it never points to an expired sale.
For the block method, link the Buttons block to the category archive. For the classic method, swap the shop URL for a category link built with get_term_link, guarded by an is_wp_error check. Keep one destination per button.
$term = get_term_by('slug', 'best-sellers', 'product_cat');
if ($term) {
$link = get_term_link($term);
if (!is_wp_error($link)) {
$shop_url = $link;
}
}
What Happens on an Empty Cart?
WooCommerce already handles the empty state with a Return to shop button on the classic cart and a shop link in the Cart block empty view. Your extra button should stay out of that moment. Method 2 handles this with its empty check. The Buttons block cannot hide itself, which is the honest trade off of the no code route. Empty your cart and view the page before deciding.
How Do You Test the Button on Mobile and With AJAX Carts?
Test on a real phone. Add items, change quantities, and remove an item, confirming the button stays visible after each update. Classic carts refresh totals with AJAX fragments, and a button outside the refreshed area usually survives. Also test with caching active, and clear cache after every change.
- Tap test: the button responds on the first tap and never sits under a sticky bar.
- Quantity test: change a quantity and confirm the button remains after totals update.
- Empty test: remove every item and check the empty cart view for duplication.
- Logged out test: repeat the full flow in a private window as a guest shopper.
- Link test: the button lands on the intended shop or category page every time.
- Mini cart test: if your theme has a slide out cart, decide whether it needs the link too.
Review what else surrounds the totals. Our tutorial on how to hide related products in WooCommerce keeps the cart focused. For shoppers who still leave, our guide to recover abandoned carts in WooCommerce for free covers follow up.
What Mistakes Should You Avoid?
The most common mistake is pasting a classic hook snippet onto a block cart. Identify your cart type first, every time. The second mistake is editing plugin or parent theme files, which updates erase. Use a child theme or Code Snippets, and avoid hard coded URLs by using wc_get_page_permalink or the link picker.
Keep a backup and test on staging when you can, because cart code touches revenue directly. The WordPress developer resources explain hooks and escaping. Fast hosting matters too, since slow cart updates make every button feel broken. Our web hosting guide explains what a growing store needs.
Frequently Asked Questions
Why does my PHP snippet not show any button?
Your cart is most likely the Cart block, which does not fire classic cart hooks. Edit the Cart page and add a Buttons block under the Cart block instead. Also confirm the snippet runs on the front end and that the cart holds at least one item.
Will the button empty the cart when shoppers click it?
No. The button is a normal link to the shop or a category. WooCommerce keeps cart items in the session while the shopper browses, so they can add more products and return to the same cart.
Can I show the button only when the cart has items?
Yes on the classic cart. The snippet checks WC cart emptiness and returns early when the cart is empty. The block method cannot hide itself, so an empty block cart may show your button beside the built in Return to shop button.
Where is the best place for the button?
Place it near the cart totals, below or beside the checkout button, with quieter styling. Shoppers look there before deciding, so the option to keep browsing stays visible without stealing attention from checkout.
Last updated: December 2026.



