Create selling plans with same options but different billing causes an error.

Solved

Create selling plans with same options but different billing causes an error.

makasanas
Shopify Partner
22 0 3

We want to create selling plans with the same options but with different billing cycles in a single contract for e.g let's check the below query with deliver every month but billing should be 4 months, and 6 months.

mutation {
            sellingPlanGroupCreate(
              input: {
                appId: "WS-Subscription"
                name: "Yearly Subscript prepaid"
                merchantCode: "Yearly Prepaid"
                options: ["Delivery every"]
                position: 1
                sellingPlansToCreate: [{ 
            name: "Deliver every month Bill 4 moth",
            options: "1 MONTH",
            position: 1,
            billingPolicy: { recurring: { interval: MONTH, intervalCount: 4 } },
            deliveryPolicy: { recurring: { interval: MONTH, intervalCount: 1 } },
            pricingPolicies: [
        {
          fixed: {
            adjustmentType:  PERCENTAGE
            adjustmentValue: { percentage :30 }
          }
        }
      ]
           },{ 
            name: "Deliver Every month Bill 6 month",
            options: "1 MONTH",
            position: 2,
            billingPolicy: { recurring: { interval: MONTH, intervalCount: 6 } },
            deliveryPolicy: { recurring: { interval: MONTH, intervalCount: 1 } },
            pricingPolicies: [
        {
          fixed: {
            adjustmentType:  PERCENTAGE
            adjustmentValue: { percentage :20 }
          }
        }
      ]
           }]
              },
              resources: { productIds: ["gid://shopify/Product/6569815703721"], productVariantIds: [] }
            ) {
              sellingPlanGroup {
                id
                sellingPlans(first:10) {
                  edges {
                    node {
                      id
                    }
                  }
                }
              }
              userErrors {
                field
                message
              }
            }
          }


and we get following errors

[ { field: [ 'input', 'sellingPlansToCreate', '0', 'options' ],
    message:
     'Options Cannot have multiple selling plans with the same options.' },
  { field: [ 'input', 'sellingPlansToCreate', '1', 'options' ],
    message:
     'Options Cannot have multiple selling plans with the same options.' } ]

 
So my question is Shopify should allow users to create plans like this, Why do they have to create different contracts to achieve this. It should be achieve in one contract with selling plan group.

Hope you understand the question and gave the appropriate solution.

Thanks in advance.

Accepted Solution (1)

qc11
Shopify Staff (Retired)
47 14 12

This is an accepted solution.

Hi,

Options are usually used by theme to display the purchase options, that's why we do not allow it to be the same.


You should be able to get around it by having 2 options:

sellingPlanGroup.options: ["Deliver every", "Bill every"]

sellingPlan1.options: ["1 month", "4 month"]

sellingPlan2.options: ["1 month", "6 month"]

 

Hope this helps.

 

To learn more visit the Shopify Help Center or the Community Blog.

View solution in original post

Replies 3 (3)

qc11
Shopify Staff (Retired)
47 14 12

This is an accepted solution.

Hi,

Options are usually used by theme to display the purchase options, that's why we do not allow it to be the same.


You should be able to get around it by having 2 options:

sellingPlanGroup.options: ["Deliver every", "Bill every"]

sellingPlan1.options: ["1 month", "4 month"]

sellingPlan2.options: ["1 month", "6 month"]

 

Hope this helps.

 

To learn more visit the Shopify Help Center or the Community Blog.

makasanas
Shopify Partner
22 0 3

Okay, Understood,

But my question is still the same how do I achieve to create plans like https://prnt.sc/1sizmfi. So,  customers can bill at different times.

Can you suggest to me how do I pass the query to create plans like that because as I mentioned in my query sends me an error.

qc11
Shopify Staff (Retired)
47 14 12

The mutation would look something like this:

mutation {
            sellingPlanGroupCreate(
              input: {
                appId: "WS-Subscription"
                name: "Yearly Subscript prepaid"
                merchantCode: "Yearly Prepaid"
                options: ["Delivery every", "Bill every"]
                position: 1
                sellingPlansToCreate: [{ 
            name: "Deliver every month Bill 4 moth",
            options: ["1 MONTH", "4 MONTH"],
            position: 1,
            billingPolicy: { recurring: { interval: MONTH, intervalCount: 4 } },
            deliveryPolicy: { recurring: { interval: MONTH, intervalCount: 1 } },
            pricingPolicies: [
        {
          fixed: {
            adjustmentType:  PERCENTAGE
            adjustmentValue: { percentage :30 }
          }
        }
      ]
           },{ 
            name: "Deliver Every month Bill 6 month",
            options: ["1 MONTH", "6 MONTH"],
            position: 2,
            billingPolicy: { recurring: { interval: MONTH, intervalCount: 6 } },
            deliveryPolicy: { recurring: { interval: MONTH, intervalCount: 1 } },
            pricingPolicies: [
        {
          fixed: {
            adjustmentType:  PERCENTAGE
            adjustmentValue: { percentage :20 }
          }
        }
      ]
           }]
              },
              resources: { productIds: ["gid://shopify/Product/6569815703721"], productVariantIds: [] }
            ) {
              sellingPlanGroup {
                id
                sellingPlans(first:10) {
                  edges {
                    node {
                      id
                    }
                  }
                }
              }
              userErrors {
                field
                message
              }
            }
          }

 

To learn more visit the Shopify Help Center or the Community Blog.