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 | |
4 | |
3 | |
3 | |
3 |
As a business owner, have you ever wondered when your customer's first impression of yo...
By Skye Jun 6, 2023We're excited to announce improvements to the threaded messaging experience in our communi...
By TyW May 31, 2023Thank you to everyone who participated in our AMA with Klaviyo. It was great to see so man...
By Jacqui May 30, 2023