Development discussions around Shopify APIs
Hello,
I am trying to create an app to send products to Shopify, but I had an issue while trying to create a product with variations size and color.
I am using option1 for size and option2 for color. when I go to Shopify to see the product I don't see the color, just option1.
You can see the JSON request here:
{
"product": {
"title": "Tommy Bahama Women's Petra Kaftan",
"body_html": "<br><b>DESCRIPTION:</b><br>Be bold this pool season in the Tommy Bahama Petra Kaftan. <br><br> <b>FEATURES:</b><li>Scoop neckline </li><li>Keyhole button closure on front </li><li>Flutter sleeves</li><li>Drawstring at waist</li><li>100% viscose </li><li>Hand wash </li><li>Styled with Marysia bikini top Style # ST028 and bikini bottom Style # SB028. Model is wearing size small cover-up, bikini top, and bikini bottom. </li> ",
"vendor": "TOMMY BAHAMA",
"product_type": "Tommy Bahama Women's Petra Kaftan",
"variants": [{
"option1": "L",
"option2": "KINGDOMBLUE",
"price": 128,
"sku": "410011385421",
"inventory_management": "shopify",
"requires_shipping": "true",
"taxable": "true",
"inventory_quantity": "1",
"barcode": "023793593320"
}, {
"option1": "M",
"option2": "KINGDOMBLUE",
"price": 128,
"sku": "410011385414",
"inventory_management": "shopify",
"requires_shipping": "true",
"taxable": "true",
"inventory_quantity": "2",
"barcode": "023793593313"
}, {
"option1": "S",
"option2": "KINGDOMBLUE",
"price": 128,
"sku": "410011385407",
"inventory_management": "shopify",
"requires_shipping": "true",
"taxable": "true",
"inventory_quantity": "2",
"barcode": "023793593306"
}, {
"option1": "XL",
"option2": "KINGDOMBLUE",
"price": 128,
"sku": "410011385438",
"inventory_management": "shopify",
"requires_shipping": "true",
"taxable": "true",
"inventory_quantity": "1",
"barcode": "023793593337"
}, {
"option1": "XS",
"option2": "KINGDOMBLUE",
"price": 128,
"sku": "410011385391",
"inventory_management": "shopify",
"requires_shipping": "true",
"taxable": "true",
"inventory_quantity": "1",
"barcode": "023793593290"
}],
"images": [{
"src": "http:\/\/cdn.magentosite.com\/media\/catalog\/product\/t\/w\/tw315511-kingdomblue.jpg"
}]
}
}
Hi there,
You will need to set your options in the API call you are making. Here's what that would look like:
"options": [{"name": "Size", "values": ["XS","S","M","L","XL"]}, {"name": "Colour", "values": ["KINGDOMBLUE"]}]
Can you try adding that to your call and let me know if you have trouble?
Cheers,
Andrew | 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
Following error throw when i set size value 0.
{"errors":{"base":["The variant 'Blue / 0' already exists. Please change at least one option value."]}}
"options": [{"name": "Size", "values": ["0","2","4","6","8"]}, {"name": "Colour", "values": ["KINGDOMBLUE"]}]
I am Request Sent But Showing these ERROR. Where I am Wrong in Request
stdClass Object ( [errors] => stdClass Object ( [options] => Array ( [0] => is invalid ) [name] => Array ( [0] => can't be blank ) ) )
my Request Data is:
<pre>{
"product": {
"title": "Tommy Bahama Women's Petra Kaftan",
"body_html": "<br><b>DESCRIPTION:</b><br>Be bold this pool season in the Tommy Bahama Petra Kaftan. <br><br> <b>FEATURES:</b><li>Scoop neckline </li><li>Keyhole button closure on front </li><li>Flutter sleeves</li><li>Drawstring at waist</li><li>100% viscose </li><li>Hand wash </li><li>Styled with Marysia bikini top Style # ST028 and bikini bottom Style # SB028. Model is wearing size small cover-up, bikini top, and bikini bottom. </li> ",
"vendor": "TOMMY BAHAMA",
"product_type": "Tommy Bahama Women's Petra Kaftan",
"options": [{"name": "Size", "values": ["XS","S","M","L","XL"]}, {"name": "Color", "values": ["KINGDOMBLUE"]}],
"variants": [{
"option1": "L",
"option2": "KINGDOMBLUE",
"price": 128,
"sku": "410011385421",
"inventory_management": "shopify",
"requires_shipping": "true",
"taxable": "true",
"inventory_quantity": "1",
"barcode": "023793593320"
}, {
"option1": "M",
"option2": "KINGDOMBLUE",
"price": 128,
"sku": "410011385414",
"inventory_management": "shopify",
"requires_shipping": "true",
"taxable": "true",
"inventory_quantity": "2",
"barcode": "023793593313"
}, {
"option1": "S",
"option2": "KINGDOMBLUE",
"price": 128,
"sku": "410011385407",
"inventory_management": "shopify",
"requires_shipping": "true",
"taxable": "true",
"inventory_quantity": "2",
"barcode": "023793593306"
}, {
"option1": "XL",
"option2": "KINGDOMBLUE",
"price": 128,
"sku": "410011385438",
"inventory_management": "shopify",
"requires_shipping": "true",
"taxable": "true",
"inventory_quantity": "1",
"barcode": "023793593337"
}, {
"option1": "XS",
"option2": "KINGDOMBLUE",
"price": 128,
"sku": "410011385391",
"inventory_management": "shopify",
"requires_shipping": "true",
"taxable": "true",
"inventory_quantity": "1",
"barcode": "023793593290"
}],
"images": [{
"src": "http:\/\/cdn.magentosite.com\/media\/catalog\/product\/t\/w\/tw315511-kingdomblue.jpg"
}]
}
}</pre>
Connect your PayPal account to allow your customers to checkout using the PayPal gateway a...
ByYour online store speed can enhance your store’s discoverability, boost conversion rates a...
ByShopping is at our fingertips with mobile devices. Is your theme optimized to be user-frie...
By