What does repeating SellingPlanGroupCreate do?

What does repeating SellingPlanGroupCreate do?

HunkyBill
Shopify Partner
4853 60 562

I have a mutation that creates a Group and then assigns plans to it. I run this query once in a store for a product variant. So I end up with a variant I can sell as a subscription.

 

mutation {
sellingPlanGroupCreate(
  input: {
     name: "Beer Drinking Membership",
     merchantCode: "Beer Drinking Membership",
     options: ["yearly membership"],
     position: 1,
     sellingPlansToCreate: [
      {
       name: "Beer Drinking Membership",
       options: "Year",
       position: 1,
       billingPolicy: {
         recurring: {
           interval: YEAR,
           intervalCount: 1,
           maxCycles: 3
         }
       }
       deliveryPolicy: {
         recurring: {
           interval: YEAR,
           intervalCount: 1
         }       
       },
       pricingPolicies: [
				{
          fixed: {
            adjustmentType: PRICE
            adjustmentValue : {
              fixedValue : 100  
            }
          }
        },{
          recurring: {
            adjustmentType: PRICE
            adjustmentValue: {
              fixedValue : 100
            }
            afterCycle: 1
          }
        },
      ]
     }
    ]
  },
  resources: {
      productVariantIds: ["gid://shopify/ProductVariant/415222220353197"],
  }
)
{
   sellingPlanGroup {
      id
      sellingPlans(first: 10) {
        edges {
          node {
            id
          }
        }
      }
   }
   userErrors {
  	field
  	message
   }
  }
}



Now I just send that same request 6 times. I end up with a Group that now has seven selling plans in it. All identical and all for the same variant. Yay.

Are there any implications to this I should know about? Is this going to cause some kind of problem? What does it mean to assign more than one identical plan to a variant?

Custom Shopify Apps built just for you! hunkybill@gmail.com http://www.resistorsoftware.com
Reply 1 (1)

dewyze
Shopify Staff
10 1 1

Hey there! Thanks for the question.

 

In short: Exact duplicates won't be a problem.

If you checkout this link about selling plan groups, you can see:

 

"Selling plans are grouped together in Liquid when they are created by the same app, and have the same selling_plan_group.name and selling_plan_group.options values. For more information, refer to the selling_plan_group object."

 

One the front end, the groups 

 

Also on that page:

 

Selling plans and associated records (selling plan groups, policies, and associations to products and variants) are deleted 48 hours after a merchant uninstalls their subscriptions app. Products and variants themselves are preserved. We recommend backing up records if you need to restore them later.

 

So on the product pages, we will group "identical" selling plans. Once a customer checks out, subscription contracts will be created and those will determine how the customer is charged (and contracts can be modified in certain ways). At that point, a selling plan/group could be deleted and it will not have an effect on existing contracts.

 

In summary, the duplicate groups may just cause confusion on your end, but for customers should not be something they really see or know about.

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