Development discussions around Shopify APIs
I'm trying to update the value of each option's position in order to reorder my options and have not been successful in doing so. When making the PUT calls, I'll get a 200 response but when parsing through the value of the options key in the product object that is returned, the position values have not changed.
I'm making PUT requests with the following payload:
{"product": {"id": 343297745, "options": [{"position": 1, "product_id": 343297745, "id": 404882001, "name": "Style"}, {"position": 3, "product_id": 343297745, "id": 404882005, "name": "Color"}, {"position": 2, "product_id": 343297745, "id": 404882009, "name": "Size"}]}}
I'll get a 200 response but the Options object looks like this:
[{"position": 1, "product_id": 343297745, "id": 404882001, "name": "Style"}, {"position": 2, "product_id": 343297745, "id": 404882005, "name": "Color"}, {"position": 3, "product_id": 343297745, "id": 404882009, "name": "Size"}]
Can someone help?
Because you are including the position in the request they are getting sorted then updated in the order based on that position value and not on their position in the array. If you want to be able to use the index of the entries, simply drop the position value and they will be stored in that order.
Chris | Shopify
- Was my reply helpful? Click Like to let me know!
- Was your question answered? Mark it as an Accepted Solution
- To learn more visit the Shopify Help Center or the Shopify Blog
User | RANK |
---|---|
10 | |
5 | |
3 | |
3 | |
3 |
Photo by Marco Verch Sales channels on Shopify are various platforms where you can sell...
By Ollie May 25, 2023Summary of EventsBeginning in January of 2023, some merchants reported seeing a large amo...
By Trevor May 15, 2023With 2-Factor Authentication being required to use Shopify Payments, we’re here to help yo...
By Imogen Apr 26, 2023