Blog post
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 with global fetch, XHR, and form intercept.

In some cases, it may be necessary to completely prevent users from adding products to the cart in Shopify stores. For example, a specific product type, an SKU displayed solely for display purposes, products closed for pre-order, or third-party applications conflicting with the store setup may cause this. However, simply removing the "Add to Cart" button is often insufficient, as Shopify's /cart/add endpoint can be triggered in different ways. In this guide, we'll take a detailed look at how to block add-to-cart behavior globally in Shopify.

Why Block /cart/add in Shopify?

The add-to-cart process in Shopify is not limited to theme files. Users or applications can send add-to-cart requests in different ways:

  • Manual fetch call via the browser console
  • Automatic /cart/add triggering by third-party applications
  • Scripts or embedded widgets
  • AJAX-based forms or custom buttons

Therefore, intervening only in front-end components is not sufficient for true blocking. The real goal should be to capture all /cart/add calls in the browser, regardless of their source.

The Logic of Globally Capturing /cart/add Requests in Shopify

If you want to control the add-to-cart behavior 100%, you need to create a guard (protection layer) that covers all request types coming from the browser. The purpose of this guard is:

  • To intercept any fetch requests
  • XMLHttpRequest-based requests
  • POST requests sent via form submit

to intercept them globally and block all URLs containing /cart/add.

With a small script that captures these three levels:

  • Theme-related requests
  • Third-party application requests
  • Manual fetch() calls made from the user console
  • Widgets or snippets running in the background

can all be blocked in one place.

How does Global Guard work?

The created guard listens to the request flow in the browser. Even if a user or application performs the following action:

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

the request is blocked and a custom response you specify is returned.

This way, both the user experience is kept under control and you prevent applications that conflict with your site's logic from performing unexpected actions.

For example:

  • If the "Add to Favorites" application accidentally triggers "Add to Cart," it is blocked.
  • Promotional applications cannot perform automatic cart manipulation
  • Someone attempting to add products to the cart via the console will not succeed

This method is particularly useful for stores without Shopify Plus, where backend control is limited.

Is Global Blocking Enough on Its Own?

Not entirely. A technically knowledgeable person could theoretically bypass the guard.

Therefore, as a second layer of security, it may be wise to use Shopify's own stock control mechanism.

Alternative Security: Track Quantity + Negative Stock Logic

For products that should not be added to the cart:

  • Enable the Track Quantity option
  • By keeping the product's stock quantity negative (e.g., -100)

you can ensure the product is invalidated during the checkout process.

Shopify automatically cancels the checkout process for products with no stock.

This method prevents the purchase even if the guard is bypassed.

A minor code adjustment may be required on the theme side to ensure the product appears as "in stock."

It is possible to completely take control of adding items to the cart in Shopify

If you want to completely prevent adding products to the cart on Shopify, a single method is not sufficient.

Both:

  • Browser-based global guard
  • And Track Quantity + inventory management

When used together, they provide a powerful and reliable solution.

This method:

✔ Keeps third-party applications under control

✔ Stops manual /cart/add calls

✔ Fully protects products you don't want added to the cart

✔ Provides additional security measures during checkout with Shopify's security verification