Quick answer
Shopify is rejecting add-to-cart requests with the error "A variant can only be purchased with a selling plan" whenever a product is configured to require a subscription plan and the cart request doesn't include a valid selling plan identifier.
Shopify is rejecting add-to-cart requests with the error "A variant can only be purchased with a selling plan" whenever a product is configured to require a subscription plan and the cart request doesn't include a valid selling plan identifier.
The error is most common inside custom quick-add buttons, slide-out upsell drawers, predictive search add-to-cart cards, and headless storefronts that submit only a variant identifier and quantity when adding to cart.
If you've ever been confused by the error message, here's what it means and how to fix it.
Shopify offers two ways for merchants to sell subscription plans alongside one-time purchases. You can either allow customers to choose between a one-time purchase or a subscription, or you can restrict the product to subscription-only.
Products configured to subscription-only will only work with the add-to-cart endpoint when a valid selling plan identifier is passed along with the variant ID and quantity.
If you're selling the same product as both a one-time and subscription purchase, the fix is simple. Just disable the subscription-only option in your Shopify product purchase options.
Products that are subscription-only and that you intentionally want to keep that way will need to pass a valid selling plan identifier in every theme form, cart script, and storefront checkout request.
If you're still getting the error after passing a selling plan identifier, you may have orphaned selling plan groups in your store from a previous subscription app that you uninstalled without cleaning up the leftover data.
To fix this, you'll need to separate your storefront publishing channels from your active billing contracts. This way you can keep your existing subscriptions active and renewing while hiding the retired plans from your storefront.
When you're done, all of your existing subscriptions should continue to renew as expected while your new storefront only displays your active selling plans.
Root-cause diagnostic matrix
| Symptom / Error Message | Root Cause | Exact Fix |
|---|---|---|
Variant can only be purchased with a selling plan on collection quick-add | Product has requires_selling_plan: true, but quick-add submits only id & quantity | Either disable 'Only sell as a subscription' or pass default selling_plan ID in quick-add payload |
| Error persists after uninstalling old subscription app | Orphaned requiresSellingPlan: true flag remained on the product record | Run productUpdate GraphQL mutation setting requiresSellingPlan: false |
| Subscription widget missing on product page | Theme app embed disabled or selling plan group detached from Online Store channel | Enable the app embed in Theme Editor and verify Online Store channel visibility in Selling Plans settings |
| Headless Storefront API cart mutation fails | cartLinesAdd omitted sellingPlanId GID on a subscription-only variant | Pass sellingPlanId: "gid://shopify/SellingPlan/..." on each subscription line item |
| Bundle or upsell drawer drops subscription discount | Drawer calls /cart/add.js without copying the selected selling_plan property | Read variant.selling_plan_allocations[0].selling_plan.id and include selling_plan in AJAX body |
Working /cart/add.js and Admin GraphQL fixes
Storefront AJAX /cart/add.js payload with valid selling_plan ID
await fetch('/cart/add.js', {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({
items: [
{
id: 44123456789012, // Shopify Variant ID
quantity: 1,
selling_plan: 6891234567 // Numeric SellingPlan ID from selling_plan_allocations
}
]
})
});Admin GraphQL: clear orphaned requiresSellingPlan flag
mutation AllowOneTimePurchase($productId: ID!) {
productUpdate(product: { id: $productId, requiresSellingPlan: false }) {
product {
id
requiresSellingPlan
}
userErrors {
field
message
}
}
}Preventing storefront breaks when retiring legacy plans
- Separate storefront visibility from active contracts: In Chargezen Selling Plans, toggle Online Store off while keeping Portal, Contract import, and Subscription management enabled so legacy subscribers renew undisturbed without exposing deprecated prices on product pages.
- Guard every theme quick-add component in Liquid: Check
{% if product.requires_selling_plan %}on collection cards and link to the product page (or attachvariant.selling_plan_allocations.first.selling_plan.id) instead of posting a bare variant ID. - Check migration CSVs before cutting over: Run exports through our free Recharge migration CSV validator so missing variant-to-selling-plan mappings never break renewal billing.
Frequently asked questions
Why does Shopify say a variant can only be purchased with a selling plan?
Shopify throws this error when the product has requires_selling_plan enabled (Only sell this product as a subscription) and the storefront form or AJAX script submits an add-to-cart request without a valid selling_plan ID.
How do I turn off requires_selling_plan across multiple Shopify products?
Uncheck 'Only sell this product as a subscription' inside each product's Purchase Options card in Shopify Admin, or batch-update products via the Shopify Admin GraphQL productUpdate mutation setting requiresSellingPlan to false.
Will removing a selling plan from the Online Store cancel active subscribers?
No. Existing Shopify SubscriptionContracts store their own billing and delivery policies independently of whether the SellingPlanGroup remains visible on the Online Store channel.
How do I pass a selling plan ID in Shopify Hydrogen or Storefront API?
Include the full global ID (gid://shopify/SellingPlan/...) in the sellingPlanId field of each CartLineInput object passed to cartCreate or cartLinesAdd.
Written by
Ryan Cooper
Subscriptions Solutions Lead, Chargezen
Ryan leads subscriptions solutions at Chargezen, and writes about the systems and strategies behind modern subscription businesses. His writing explores recurring billing, subscription lifecycle management, payment recovery, pricing optimization, and the role of AI in revenue operations. He focuses on the practical challenges businesses face as they scale recurring revenue, from reducing involuntary churn and managing complex billing workflows to building more efficient systems for monetization.
