MONEI / Shopify-api-node

Node Shopify connector sponsored by MONEI
https://monei.com/shopify-payment-gateway/
MIT License
940 stars 279 forks source link

Need to reposition all variants through API #557

Closed xmdcode closed 1 year ago

xmdcode commented 1 year ago

Hello ,

I am trying to reposition all product variants based on their grams and what i need to do is to use update the product.

I found this solution in shopify forums https://community.shopify.com/c/shopify-apis-and-sdks/reorder-options-variants/m-p/473817/highlight/true#M30070

but this apply to an PUT(update call).

Is there any change you can elaborate how i can do it through this library?

I can't seem to find the way to send all variants and their values sorted through this library.

I am using this library for 2 production apps and it's going pretty smooth so far.

lpinca commented 1 year ago

Use shopify.product.update(id, params), where params is an object like this:

{
  id: 123456789,
  variants: [
    {
      option1: 'S'
    },
    {
      option1: 'M'
    }
  ],
  options: [
    {
      name: 'Size',
      values: ['S', 'M']
    }
  ]
}
lpinca commented 1 year ago

I'm closing this as answered.