Continue selling when out of stock but limiting the pre-order quantity

Topic summary

A developer is seeking a solution to enable pre-orders with quantity limits after regular inventory sells out. The specific scenario: a t-shirt with 50 units in stock should switch to pre-order mode once sold out, but limit pre-orders to only 20 additional units.

Current Challenge:

  • Shopify’s native “continue selling when out of stock” setting doesn’t provide separate quantity caps for pre-orders
  • Uncertain how to control the pre-order quantity while allowing sales to continue

Proposed Solutions:

Manual approach:

  • Use JavaScript in the product template to check variant.inventory_quantity via AJAX API
  • Disable add-to-cart button when inventory reaches the threshold (e.g., -20)
  • Requires server-side validation using Shopify Scripts (Plus only) or checkout validation to prevent cart manipulation

App-based alternative:

  • K1 PreOrder app can automate this with inventory-based display modes (Always/Out of Stock/Below threshold)
  • Handles automatic “Continue selling when out of stock” management and rule activation/deactivation

Trade-offs: Theme customization requires ongoing manual monitoring for inventory changes and both client-side and server-side logic implementation.

Summarized with AI on November 3. AI used: claude-sonnet-4-5-20250929.

Hey everyone,

Sorry if this is the wrong place to post this but I’m a little bit stuck.

I’m currently developing for a store who is trying to implement a feature where after an item is sold out, it goes into pre-order. However, it’s limited to a certain amount of quantity. Can someone point me in the right direction. I’ve been trying to look for more details on this but it doesn’t seem like anyone has asked or implemented this yet.

For example, there is currently a t-shirt that has 50 in-stock. Once the 50 t-shirts are sold out, it goes into pre-order. But there is only 20 t-shirts in the next shipment. So, I want to limit the t-shirts preorders to 20 only.

I know about the variant setting “continue selling when out of stock” and how it returns variant.inventory_policy continue but I’m not sure how to control the amount being sold.

I have the idea of allowing orders to continue after sold out and disabling the pre-order button after its at -20 or something but I’m pretty sure that probably not the right approach to this as it also doesn’t alter the behavior in cart and would let customers order more than the -20 quantity number.

Thanks

2 Likes

Hey,

Unfortunately, Shopify doesn’t provide a native setting to cap pre-order quantities separately from regular inventory. A workaround using theme code requires adding JavaScript to your product template that checks variant.inventory_quantity via the AJAX API and disables the add-to-cart button when inventory falls below your target threshold (e.g., -20). You’d also need server-side validation using Shopify Scripts (Shopify Plus) or checkout validation to prevent cart manipulation. Here’s Shopify’s theme editing guide for reference.

Trade-offs: requires theme customization and server-side logic; manual monitoring needed if inventory changes.

Alternately, an app like K1 PreOrder can automate that (I’m the founder of K1 PreOrder), replacing the button with inventory-based display modes (Always / Out of stock / Below threshold) and automatic “Continue selling when out of stock” management at rule activation/deactivation. If this is relevant, here’s the K1 PreOrder listing.

Happy to help with the theme customization if needed.

Best regards,
Yauheni