For discussing the development and integration of subscription-enabled shops using Shopify's Subscription APIs.
I have created a subscription Group on a products variant, but when I try adding the item to the cart I am getting
status: 422, message: "Cart Error", description: "Cannot apply selling plan to variant"
mutation {
sellingPlanGroupCreate(
input: {
name: "Monthly"
merchantCode: "Monthly"
options: ["Monthly"]
position: 1
sellingPlansToCreate: [
{
name: "Monthly"
description: "Payments the first of the month"
options: "Monthly Payments"
position: 1
billingPolicy: { recurring: { interval: MONTH, intervalCount: 1 ,maxCycles:8, anchors:{type:MONTHDAY,day:1}} }
deliveryPolicy: { recurring: { interval: MONTH, intervalCount: 1 , anchors:{type:MONTHDAY,day:1}} }
}
]
}
resources: { productIds: [""], productVariantIds["gid://shopify/ProductVariant/4127279"] }
) {
sellingPlanGroup {
id
}
userErrors {
field
message
}
}
}
Solved! Go to the solution
This is an accepted solution.
I was using SellingPlanGroup id not SellingPlan id
This is an accepted solution.
I was using SellingPlanGroup id not SellingPlan id
@Tiber Can you explain where are you using the SellingPlanGroup id instead of the SellingPlan id?
Hey @Lokesh_Saini
It was for adding an item with a subscription through JavaScript