Dark Light

How to Change the Return to Shop Link in WooCommerce in 2026

Varun Dubey 12 min read

The “Return to Shop” button appears on the WooCommerce cart page whenever the cart is empty. By default it points to your main Shop page, but that may not be where you actually want customers to go. In 2026, with WooCommerce now supporting both the classic shortcode cart and the new Cart Block, changing this link requires a slightly different approach depending on how your store is built. This guide covers every method: the PHP filter, the Customizer, the Cart Block setting, and CSS, so you can pick the one that fits your setup and get it done in under five minutes.


What Is the Return to Shop Button?

When a visitor lands on your cart page and it is empty, either because they haven’t added anything yet or because they removed all items, WooCommerce displays a “Return to Shop” button. The button’s purpose is to redirect customers back into your product catalog so they keep browsing instead of leaving your site.

By default, WooCommerce points this button to the page you have configured as your Shop page under WooCommerce > Settings > Products > Shop page. That is fine for most stores, but some situations call for a different destination. You might want to send customers to a specific product category such as “Sale Items” or “New Arrivals” instead of the generic shop listing. Your store might run a campaign landing page, and you want the empty cart to drive traffic there instead. You may want to remove the button entirely to avoid distracting shoppers. Or you may want to rename the button text to something more on-brand, “Continue Shopping”, “Browse Collections”, or “Discover More”. All of this is achievable without any premium plugin.


Method 1: PHP Filter (Works for Classic Cart and Cart Block)

The most reliable method is adding a short PHP snippet to your child theme’s functions.php file. The filter woocommerce_return_to_shop_redirect fires both on the classic shortcode-based cart page and on the WooCommerce Cart Block in WooCommerce 8.0 and later. This means you do not need to handle the two cart implementations separately, one snippet covers both. The filter receives the current return URL as its argument and expects a string URL back, so you can return any valid URL you like.

Step 1, Open Your Child Theme’s functions.php

Never edit the parent theme’s functions.php directly. If you update your theme in the future, the parent theme’s files get overwritten and you will lose your changes. Instead, always use a child theme. If you don’t have a child theme already, create one first or use a plugin like Child Theme Configurator from the WordPress plugin directory. Alternatively, use a code-snippet plugin like Code Snippets to add the PHP without touching any theme file at all, this is the safest approach for non-developers because a syntax error in a code snippet plugin won’t take down your site, while a syntax error in functions.php can cause a fatal error.

Step 2, Add the Filter

Paste the following snippet and change the URL to wherever you want customers redirected. Save the file, then load an empty cart page in an incognito window and click the button, it will now go to the URL you specified. You can point it to any valid URL on your site: a product category archive, a landing page, a specific product, a seasonal sale page, or even an external URL. The filter returns a string, so you have complete freedom over the destination.

Step 3, Optionally Change the Button Text Too

If you also want to rename the button label, from “Return to Shop” to “Browse Products”, for example, extend the snippet using the gettext filter. The gettext filter intercepts every translated string in WordPress, so you target the specific string “Return to shop” from the WooCommerce text domain. The match is case-sensitive, so the string must match exactly as WooCommerce outputs it. This approach works for both the classic cart button and the Cart Block button label.

Always use a child theme or a dedicated code-snippet plugin for this kind of change. If you modify the parent theme directly, your customization will be wiped out next time the theme updates.


Method 2: WooCommerce Cart Block (Block Theme and Full Site Editing)

WooCommerce introduced its block-based cart in version 7.x and significantly improved it through WooCommerce 8.x and 9.x. If your store uses the WooCommerce Cart Block, which is the default for new installs using a block theme, the PHP filter above still works. But you also have a point-and-click option inside the block editor itself, which requires zero code. This is useful for store owners who manage the site themselves and want to avoid editing PHP files.

The Cart Block renders its UI through React components on the front end, but the server-side filter still fires when WooCommerce processes the cart state. This dual architecture is why the PHP filter is universally reliable across both the classic and block implementations. The block editor option is simply a convenience wrapper around the same underlying setting, when both are set, the block editor field takes priority; when it is blank, the filter value wins.

Here is how to change the Return to Shop URL directly inside the Cart Block without writing any code. Start by going to Pages in your WordPress admin and opening your Cart page for editing. Click on the WooCommerce Cart block to select it. In the right-hand Block sidebar panel, look for the “Return to Shop” link setting, this was added in WooCommerce 8.2, so if you do not see it, update WooCommerce first. Type or paste the URL you want the button to redirect to, then click Update to save. Clear any page cache and test with an empty cart in an incognito window to confirm the change took effect.

PHP Filter With Cart Block for Advanced Control

Even when you are running the Cart Block, the woocommerce_return_to_shop_redirect filter fires on the server side. So if you prefer code over UI clicks, or if you need conditional logic such as different URLs for different user roles, the filter approach will work regardless of which cart implementation you use. The PHP approach also survives theme changes and WooCommerce updates, whereas the block editor field is stored as block attributes and may need to be re-entered if you rebuild the Cart page.


Method 3: WooCommerce Settings and Customizer (Classic Themes)

If you are on a classic non-block theme that supports the WordPress Customizer, WooCommerce exposes the Shop page setting through the admin. While you cannot change the Return to Shop URL directly in the Customizer, you can change which page WooCommerce treats as the Shop page, and the Return to Shop button will automatically point there. This method works best when you genuinely want both your shop archive and your Return to Shop button to point to the same page.

If you need the Return to Shop button to go to a different URL than your Shop page, for instance, your shop archive is at /shop/ but you want the empty-cart button to go to /sale/, you must use the PHP filter instead. The Customizer and Settings UI alone cannot split those two destinations. The Settings path for the shop page is WooCommerce > Settings > Products > General > Shop page. Select the page you want from the dropdown and click Save changes. Note that changing this field affects your shop archive URL across the entire store, so make sure the page you select is appropriate for both purposes.


Method 4: Hide the Return to Shop Button with CSS

Some store owners prefer to remove the button entirely. If your cart page already has sufficient navigation, top menu, breadcrumbs, a recently viewed products widget, or a persistent mini-cart sidebar, the Return to Shop button may be redundant. Hiding it with CSS is the fastest approach and requires no PHP and no plugin installation. The selector differs between the classic cart and the Cart Block, so the snippet below covers both.

Add these styles under Appearance > Customize > Additional CSS for classic themes, or inside your theme’s style.css file. For block themes using the Full Site Editor, paste the CSS into Appearance > Editor > Styles > Additional CSS. The snippet targets both the classic cart button selector and the Cart Block’s equivalent element, so you only need to add it once regardless of which cart implementation you use.

The snippet also includes an optional custom-styling section that makes the button more visually prominent using WooCommerce’s default purple brand color with a hover transition. This is useful if you want to keep the button but make it stand out more clearly, simply remove the display: none rule and keep the styling declarations below it.


Advanced: Dynamic Return to Shop URLs

One of the real advantages of the PHP filter approach over the block editor UI is that you can make the destination URL conditional. This is useful for stores that run seasonal promotions, serve multiple customer segments, or want to personalize the empty-cart experience based on user context. Here are three practical patterns that WooCommerce developers use in production.

Different URL for Logged-In vs Guest Users

If your store has a members-only product section, you can redirect logged-in customers to their member catalog and send guests to the public shop. Inside your filter callback, check the WordPress function is_user_logged_in() and return the appropriate URL for each case. This personalizes the empty-cart experience based on account status and can improve conversion rates for stores with tiered pricing or member-exclusive products.

Active Sale Campaign Redirect

During a sale event, Black Friday, a seasonal clearance, or a product launch, you can set a campaign page as the Return to Shop destination using a WordPress option. Store a flag like wss_active_campaign_url via the Options API using update_option(), then read it back in the filter with get_option(). When the campaign ends, delete the option with delete_option() and the filter automatically falls back to your default shop URL. This gives your marketing team full control without needing a developer for every campaign toggle.

Category-Aware Redirect

If a customer came from a specific product category before adding items to the cart, you can use session data or a cookie to redirect them back to that category when the cart becomes empty. Store the last-visited category URL in a WooCommerce session variable when the customer views a category archive, then read it back in the filter. The result feels seamless: the customer returns to exactly where they were browsing rather than the generic shop root, which tends to result in more products added to cart on the second pass.


Which Method Should You Use?

Store SetupBest MethodRequires Code?
Classic theme + shortcode cartPHP filter or WooCommerce SettingsYes (or Settings UI)
Block theme + Cart BlockCart Block sidebar option or PHP filterNo (UI available in WC 8.2+)
Want different URL than Shop pagePHP filterYes
Want to rename the button textPHP gettext filterYes
Want to hide the button entirelyCSSYes (minimal)
Need conditional/dynamic URL logicPHP filter with conditional returnYes

While you are customizing your cart behavior, these related guides will help you take your WooCommerce store further:


Troubleshooting: Button Still Showing Old URL?

If you added the PHP snippet and the button still points to the old URL, work through this checklist before assuming something is broken with your code.

Page cache: Clear your caching plugin such as WP Rocket, W3 Total Cache, or LiteSpeed Cache, and reload the cart page in an incognito window. Cached HTML will serve the old button even if the filter is working correctly server-side. This is the most common cause of the change appearing not to work.

Plugin conflict: Deactivate plugins one by one to check if another plugin is overriding the filter with a higher priority. WooCommerce page builder plugins and some checkout optimization plugins are common culprits. You can also add a higher priority to your own filter hook, the third argument to add_filter() defaults to 10, so passing 20 or higher will make your callback run after most other plugins.

Wrong cart page: Confirm your actual cart page under WooCommerce > Settings > Advanced > Page setup. If the Cart page field points to the wrong page, the filter may not be triggering on the page you are testing. Also verify your child theme is active under Appearance > Themes, if the parent theme is active, your child theme’s functions.php is not loading at all.

Syntax error in functions.php: A PHP parse error will silently disable the entire file on some hosts, or cause a white screen of death. Always check your site’s PHP error log after saving changes to functions.php, or use a syntax validator before saving. If you used a code-snippet plugin, check the plugin’s error log tab.


Frequently Asked Questions

Does the woocommerce_return_to_shop_redirect filter work with the Cart Block?

Yes. As of WooCommerce 8.0 and later, the woocommerce_return_to_shop_redirect filter fires on the server side for both the classic shortcode cart and the Cart Block. Adding the filter to functions.php will change the button URL regardless of which cart implementation you use. The Cart Block’s UI field in the block editor (added in WooCommerce 8.2) takes priority when filled in, but leaving it blank falls back to the filter value automatically.

Can I change the Return to Shop button text without a plugin?

Yes. Use WordPress’s built-in gettext filter to intercept the string “Return to shop” from the woocommerce text domain and replace it with any label you want. The string is case-sensitive, it must match “Return to shop” exactly as WooCommerce outputs it. See Method 1, Step 3 above for the exact code snippet. No plugin is required for this change.

No, the PHP filter only changes the Return to Shop button destination on the empty cart page. Your Shop page URL, navigation menus, breadcrumbs, and other links remain completely unaffected. If instead you change the Shop page in WooCommerce Settings, that does affect the shop archive URL site-wide, so use the PHP filter if you want to change only the empty-cart button without touching anything else across the site.

Can I point the Return to Shop button to an external URL?

Yes. The filter accepts any valid URL, including external ones. Just return the full URL including the protocol in your callback function. There is no restriction to on-site URLs. Some stores use this to redirect empty-cart visitors to a partner site, a multi-brand marketplace, or an affiliate landing page.

Is there a no-code option for classic shortcode carts?

Not directly in WooCommerce core for the classic cart. The only no-code UI option is the Cart Block sidebar setting in WooCommerce 8.2+, which requires using the block-based cart. For classic shortcode carts, your options are the PHP filter or changing which page WooCommerce treats as the Shop page under WooCommerce > Settings > Products. If you want to avoid code, switching to the Cart Block is the recommended path going forward since WooCommerce is converging on the block architecture for all cart and checkout functionality.

How do I remove the Return to Shop button completely?

The simplest approach is CSS. Use .woocommerce-cart .return-to-shop { display: none; } for the classic cart, and .wp-block-woocommerce-cart .wc-block-cart__return-to-shopping-button { display: none; } for the Cart Block. See Method 4 above for the complete CSS snippet including the optional custom styling. You can add these rules under Appearance > Customize > Additional CSS without touching any PHP files or installing any plugin.


Final Thoughts

Changing the Return to Shop link is a small tweak with a real UX impact. When a customer reaches an empty cart, the destination you send them to shapes what they do next. Pointing them to a relevant product category, a seasonal sale page, or a curated landing page is almost always better than the generic shop listing, and it only takes a few lines of PHP or a single setting in the block editor.

In 2026, with WooCommerce’s Cart Block now the default for new block-theme installs, the good news is that the same PHP filter that worked for years still applies. The Cart Block sidebar option is a useful no-code alternative for teams without developers, but the filter gives you more control for conditional logic, campaign-driven routing, and dynamic destinations based on user context. Both methods are stable, well-documented, and supported in current WooCommerce versions.

Pick the method that matches your technical comfort level and theme setup, test it in an incognito window with an empty cart, and clear your cache before testing. That is all it takes to turn an otherwise dead-end empty cart page into a guided step back into your product catalog.


Need Help Customizing Your WooCommerce Store?

If you need deeper customizations, conditional cart rules, role-based redirects, or a fully custom checkout flow, our team at WooSell Services specializes in WooCommerce development. Get in touch to discuss your project.

Varun Dubey

Shaping Ideas into Digital Reality | Founder @wbcomdesigns | Custom solutions for membership sites, eLearning & communities | #WordPress #BuddyPress