Our Partner & Developer boards on the community are moving to a brand new home: the .dev community forums! While you can still access past discussions here, for all your future app and storefront building questions, head over to the new forums.

Cannot have multiple selling plans with the same name Shopify Error.

Solved

Cannot have multiple selling plans with the same name Shopify Error.

makasanas
Shopify Partner
22 0 3

Hello there,

I've been trying to update a sellingPlanGroup using the mutation called sellingPlanGroupUpdate. But it sends an error as 'Cannot have multiple selling plans with the same name.' OR 'Cannot have multiple selling plans with the same options'.

Here is the currentsellingPlanGroup

{
"data":{
    "sellingPlanGroup":{
       "appId":"WS-Subscription",
       "description":null,
       "name":"Pawty Pick Monthly Subscription",
       "options":[
          "Delivery every"
       ],
       "sellingPlans":{
          "edges":[
             {
                "node":{
                   "id":"gid:\\/\\/shopify\\/SellingPlan\\/460619843",
                   "name":"Bi Monthly",
                   "options":[
                      "2 MONTH"
                   ],
                   "position":1
                }
             },
             {
                "node":{
                   "id":"gid:\\/\\/shopify\\/SellingPlan\\/460652611",
                   "name":"Monthly",
                   "options":[
                      "1 MONTH"
                   ],
                   "position":2
                }
             }
          ]
       },
       "products":{
          "edges":[
             {
                "node":{
                   "title":"Pawty Picks - Monthly Subscription Box"
                }
             },
             {
                "node":{
                   "title":"Pawty Stronger Picks - Monthly Subscription Box"
                }
             },
             {
                "node":{
                   "title":"Pawty Smaller Picks - Monthly Subscription Box"
                }
             }
          ]
       }
    }
 },
}

 

And here is the query I have passed to update the plan. I've Just Interchange their names like Monthly to Bi Monthly and vice versa.

mutation {
    sellingPlanGroupUpdate(
      id: "gid://shopify/SellingPlanGroup/68747331"
      input: { 
        name: "Pawty Pick Monthly Subscription"
        merchantCode: "Pawty Pick Monthly Subscription" 
        sellingPlansToUpdate: [
            {
                id: "gid://shopify/SellingPlan/460619843",
                name: "Monthly",
                options: "2 MONTH",
                billingPolicy: { recurring: { interval: MONTH, intervalCount: 2 } },
                deliveryPolicy: { recurring: { interval: MONTH, intervalCount: 2 } },
                pricingPolicies: [
                    {
                        fixed: {
                            adjustmentType:  PRICE
                            adjustmentValue: { fixedValue :54.95 }
                        }
                    }]
            },
            {
                id: "gid://shopify/SellingPlan/460652611",
                name: "Bi Monthly",
                options: "1 MONTH",
                billingPolicy: { recurring: { interval: MONTH, intervalCount: 1 } },
                deliveryPolicy: { recurring: { interval: MONTH, intervalCount: 1 } },
                pricingPolicies: [
                {
                    fixed: {
                        adjustmentType:  PRICE
                        adjustmentValue: { fixedValue :49.95 }
                    }
                }]
            }]
      }
    ) {
      sellingPlanGroup {
        id
        name
        sellingPlans(first:10) {
          edges {
            node {
              id
            }
          }
        }
      }
      userErrors {
        field
        message
      }
    }
  }

 
So it always returns an error. 

[ { field: [ 'input', 'sellingPlansToUpdate', '0', 'name' ],
    message:
     'Name Cannot have multiple selling plans with the same name.' },
  { field: [ 'input', 'sellingPlansToUpdate', '1', 'name' ],
    message:
     'Name Cannot have multiple selling plans with the same name.' } ]



I am updating both of the selling plans by just changing their name or options and then passes.

How do I change just name or options within multiple selling plans then.???

Accepted Solution (1)
diegolippel
Shopify Staff
19 4 6

This is an accepted solution.

Understood. We have opened an internal issue to handle this.

Thank you for your report.

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

View solution in original post

Replies 3 (3)

diegolippel
Shopify Staff
19 4 6

Hello!

Apologies if I misunderstood, but I believe the problem is caused by flipping the exact same names. This is a bit problematic because during the operation, we'll end up with 2 selling plans with the same name: plan 1 being "Monthly" and plan 2 being "Bi-Monthly", if you update plan 1 to be "Bi-Monthly" and plan 2 to be "Monthly", we're probably hitting a point where both plans 1 and 2 are called "Bi-Monthly" (while updating plan 1 but before updating plan 2).

So if you change the names to be something different than one of the other plans (e.g. use "Bi Monthly" instead temporarily, so it doesn't clash, then update again), the problem should not happen anymore.

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

makasanas
Shopify Partner
22 0 3

Thank you for your reply,

As you said that we are flipping just names and that causes the problem, So I know that but it looks really weird as a user experience. 

Like they are seeing they are updating both selling plans at a time then why it will be not changing. Because they are changing both of them so it should be updated. You are right if they change some other name it will update but what if they just want to interchange names, in case they save it by mistake and now they want to update just by flipping names.

Shopify should update both of them if both of the selling plan names are not the same while updating like in my case. Hope you understand and let me know if you need more detail to understand.


diegolippel
Shopify Staff
19 4 6

This is an accepted solution.

Understood. We have opened an internal issue to handle this.

Thank you for your report.

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