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
909 23 184

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)