Blog Content
November 25, 2025

How to Completely Block Adding Products to Cart in Shopify

Do you want to completely block adding products to the cart on your Shopify store? Here's how to block /cart/add by intercepting fetch, XHR and form requests globally.

To completely block adding products to the cart in Shopify, hiding the “Add to cart” button isn't enough; /cart/add requests must be stopped. The most reliable setup has two layers: a Global Guard script that intercepts fetch, XMLHttpRequest and form requests in the browser, and Track Quantity with stock at 0 and overselling off, so Shopify rejects it server-side.

In some Shopify stores, you may need to stop customers from adding products to the cart altogether. A special product type, a SKU that is only on display, products closed to pre-orders or third-party apps that clash with the way the store is set up can all call for this. Simply removing the “Add to cart” button is usually not enough, though, because Shopify’s /cart/add endpoint can be triggered in several other ways. In this guide, we explain in detail how to block add-to-cart behavior at a global level in Shopify.

Hiding the "Add to cart" button is a cosmetic change, not a block. Even without the button, the /cart/add endpoint can be called directly from the browser console, a third-party app or a script.

Why Do You Need to Block /cart/add in Shopify?

Adding to cart in Shopify is not a behavior limited to theme files. Users or apps can send an add-to-cart request in several ways: a manual fetch call from the browser console, third-party apps triggering /cart/add automatically, scripts or embedded widgets, and AJAX-based forms or custom buttons. That means changing front-end components alone is not enough for a real block. The real goal should be to catch every /cart/add call in the browser, whatever its source.

The Two Methods Compared

MethodHow It WorksWeak Point
Global Guard (browser side)Intercepts fetch, XMLHttpRequest and form submit requests in the browser and stops any request containing /cart/addCould in theory be bypassed by someone with technical knowledge
Track Quantity + Zero StockProduct stock is kept at 0 and "Continue selling when out of stock" stays off; Shopify rejects the /cart/add request on the server sideThe button's appearance and the "sold out" label need a separate code change in the theme

The most reliable result comes from using both together. The Global Guard stops most scenarios at browser level, while Track Quantity + zero stock acts as a final barrier: even if the guard is bypassed, the add-to-cart request is rejected on the server side.

How to Catch /cart/add Requests Globally in Shopify

If you want full control over add-to-cart behavior, you need a guard (a protective layer) in the browser that covers every type of incoming request. The purpose of this guard is to globally intercept every fetch call, every XMLHttpRequest-based request and every POST request sent through a form submit, and to stop URLs containing /cart/add or /cart/update.js (update.js adds a variant to the cart when it is given one that is not already in the cart). Cart permalinks and Storefront API calls never pass through the browser guard, so only the server-side stock check stops them. A small script that catches these three levels can block, in one place, requests from the theme, requests from third-party apps, fetch() calls made manually from the console and widgets or snippets running in the background.

How Does the Global Guard Work?

The guard listens to the flow of requests in the browser. Even if a user or an app runs the following:

/cart/add.js request sent from the console and the GUARD_CART_ADD_BLOCKED response on a demo store with Guard installed

fetch('/cart/add.js', { method: 'POST', body: {...} })

the request is blocked and a custom response that you define is returned. This keeps the user experience under control and stops apps that conflict with your site’s logic from doing anything unexpected. For example, a wishlist app that triggers add-to-cart by mistake is blocked, promotion apps cannot manipulate the cart automatically, and anyone trying to add a product to the cart from the console gets nowhere. This method works on every plan; if you need a stricter server-side rule, a Cart and Checkout Validation Function, which also runs on every plan, can add a block at the cart and checkout stage.

Important: Global blocking is not enough on its own. Someone with technical knowledge could in theory bypass the guard. That is why you should use Shopify's own inventory control as a second layer of protection.

An Extra Safeguard: Track Quantity + Zero Stock

For products that must not be added to the cart, you can block add-to-cart on the server side by turning on Track Quantity, keeping the stock at 0 and leaving “Continue selling when out of stock” turned off. Shopify then rejects the /cart/add request; there is no need to push stock into negative numbers. This method also stops a request that has managed to get past the guard. The theme change is only for the button’s appearance and the “sold out” label.

Track quantity on, stock at 0, and continue selling when out of stock turned off in Shopify product inventory

A Related Scenario: Display-Only Products

If a product you want to keep out of the cart should actually be completely invisible (reachable only through a special link and not shown to everyone even as a display item), that is a different scenario, and Shopify's unlisted product status may be a better fit. We cover this in detail in our guide to the unlisted product status.

How We Set Up Custom Restrictions Like This at Nodus Works

Custom behavior changes that no standard app covers, such as an add-to-cart restriction, usually come from a business rule specific to the store (a B2B price list, pre-orders, a display-only product). For stores that want this kind of custom logic built at code level without clashing with their current theme and apps, our Shopify integration solutions and custom app development service takes on the development.

FAQ

Is removing the "Add to cart" button enough? No. Even if the button is removed, the /cart/add endpoint can be called directly from the browser console, a script or a third-party app. A real block requires catching requests at a global level.

Can the Global Guard be bypassed? In theory, someone with technical knowledge could bypass it. That is why we recommend using it together with the Track Quantity + zero stock method; the two together give a far more reliable result.

Is the Track Quantity method enough on its own? The Track Quantity method blocks add-to-cart on the server side: if stock is 0 and "Continue selling when out of stock" is off, the /cart/add request is rejected. The theme change is only for the button's appearance and the "sold out" label; for the user experience, using it together with the Global Guard gives a more consistent result.

Does this method require Shopify Plus? No. Quite the opposite: it is especially useful for stores that are not on Plus, because their backend control is limited. It can be applied without Plus's checkout customization tools.

Conclusion

If you want to block adding products to the cart in Shopify completely, a single method will not do. Using a browser-based global guard together with Track Quantity + inventory management gives you a strong, reliable solution: it keeps third-party apps under control, stops manual /cart/add calls, fully protects the products you do not want added to the cart and adds an extra safeguard at the add-to-cart stage through Shopify’s server-side stock check.

If you want restrictions like this built at code level for your store, you can turn to our integration service.