Development discussions around Shopify APIs
To continue receiving payouts, you need to secure your account by turning on two-step authentication. If two-step authentication is not turned on your payouts will be paused. Learn more
I'm Trying To Create A Product With Multiple Product Option Here Is The JSON I'm Using.
API URL : https://xyz.myshopify.com/admin/api/2020-07/products.json
JSON :
{
"product": {
"title": "New Product Json",
"body_html": "XYZ",
"vendor": "MySHOP",
"product_type": "",
"published": true,
"tags": "test, test new",
"images": [{
"src": "https://www.w3schools.com/w3css/img_lights.jpg"
}],
"variants": [{
"title": "26\" x 36\" \/ Horizontal",
"option1": "26\" x 36\"",
"option2": "Horizontal",
"sku": "16127874501899",
"price": 29.95
}, {
"title": "51\" x 60\" \/ Horizontal",
"option1": "51\" x 60\"",
"option2": "Horizontal",
"sku": "16127874501937",
"price": 39.95
}, {
"title": "68\" x 80\" \/ Horizontal",
"option1": "68\" x 80\"",
"option2": "Horizontal",
"sku": "16127874501039",
"price": 49.95
}, {
"title": "88\" x 104\" \/ Horizontal",
"option1": "88\" x 104\"",
"option2": "Horizontal",
"sku": "16127874501145",
"price": 59.95
}, {
"title": "26\" x 36\" \/ Vertical",
"option1": "26\" x 36\"",
"option2": "Vertical",
"sku": "161278745052",
"price": 29.95
}, {
"title": "51\" x 60\" \/ Vertical",
"option1": "51\" x 60\"",
"option2": "Vertical",
"sku": "16127874501494",
"price": 39.95
}, {
"title": "68\" x 80\" \/ Vertical",
"option1": "68\" x 80\"",
"option2": "Vertical",
"sku": "16127874501720",
"price": 49.95
}, {
"title": "88\" x 104\" \/ Vertical",
"option1": "88\" x 104\"",
"option2": "Vertical",
"sku": "16127874501733",
"price": 59.95
}]
},
"options": [{
"name": "Size",
"values": ["26\" x 36\"", "51\" x 60\"", "68\" x 80\"", "88\" x 104\""]
}, {
"name": "Alignment",
"values": ["Horizontal", "Vertical"]
}]
}
Error:
{
"errors": {
"base": [
"The variant '26\" x 36\"' already exists."
]
}
}
Please Anybody Can Help Me Out To Solve The Error. I'm Confused Where I'm Going Wrong
If helpful, please Like and Accept Solution
if you Want to Modify / Customize your theme , Feel free to contact me
Email : vikash.hawkscode@gmail.com
Skype : vikas.hawkscode
Solved! Go to the solution
This is an accepted solution.
Happy to help you out with this.
From the code sample provided your options definition falls outside of the product object definition. Move the options definition into the product definition as illustrated below and everything should be fine.
Hope this helps, if you have any questions please don't hesitate to reach out.
Regards,
John
John C | Developer Support @ 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 Shopify.dev or the Shopify Web Design and Development Blog
This is an accepted solution.
Thanks _JCC_ for help
If helpful, please Like and Accept Solution
if you Want to Modify / Customize your theme , Feel free to contact me
Email : vikash.hawkscode@gmail.com
Skype : vikas.hawkscode
This is an accepted solution.
Happy to help you out with this.
From the code sample provided your options definition falls outside of the product object definition. Move the options definition into the product definition as illustrated below and everything should be fine.
Hope this helps, if you have any questions please don't hesitate to reach out.
Regards,
John
John C | Developer Support @ 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 Shopify.dev or the Shopify Web Design and Development Blog
This is an accepted solution.
Thanks _JCC_ for help
If helpful, please Like and Accept Solution
if you Want to Modify / Customize your theme , Feel free to contact me
Email : vikash.hawkscode@gmail.com
Skype : vikas.hawkscode
User | RANK |
---|---|
5 | |
5 | |
5 | |
5 | |
4 |
Learn these 5 things I had to learn the hard way with starting and running my own business
By Kitana Jan 27, 2023Would you love to unleash the unbridled power of the Google Shopping Channel into your sho...
By Gabe Jan 6, 2023How can you turn a hobby into a career? That’s what Emmanuel did while working as a wa...
By Skye Dec 30, 2022