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.

We're moving the community! Starting July 7, the current community will be read-only for approx. 2 weeks. You can browse content, but posting will be temporarily unavailable. Learn more

Is there any way to add multiple variants and multiple discounts using Order Edit API?

Is there any way to add multiple variants and multiple discounts using Order Edit API?

jam_chan
Shopify Partner
938 24 193

I am now adding multiple variants to an order. Each variant is entitled to a discount. For adding 4 variants, there are the API calls below: 

  1. 1 x order begin
  2. 4 x Add a new variant
  3. 4 x Add a discount to the variant
  4. 1 x commit order edit

There are 10 in total just for 4 variants. My order edit function is run when the order paid webhook is triggered. It is often running longer than 5s and it causes a timeout. Sometimes, it's running too long. It may block my threads. 

 

Is there any way I can speed up the operation, e.g. adding multiple variants or multiple discounts? Or I can only use a task queue to separate it from the thread?

BYOB - Build Your Own Bundles, SPO - SEO App to research keywords & edit social link preview
Replies 0 (0)