ruby on rails - Create variants of products with null option_value label using BigCommerce v3 API -
i using bigcommerce v3 api create products on bigcommerce store. have product 2 variants having following options
size self life dot info 1l glass amber 500ml glass amber 12 methanol sol.
when trying create product
{ "name": "product name", "type": "physical", "sku": "cdid-12345", "description": "description", "weight": 0, "width": 0, "depth": 0, "height": 0, "price": 0, "cost_price": 0, "retail_price": 0, "sale_price": 0, "categories": [1], "variants": [ { "cost_price": 0, "price": 0, "weight": 0, "sku": "mp091236", "option_values": [ { "option_display_name": "size", "label": "1l glass amber", } ] }, { "cost_price": 0, "price": 0, "weight": 0, "sku": "mp091239", "option_values": [ { "option_display_name": "size", "label": "500ml glass amber", }, { "option_display_name": "self life", "label": "12", }, { "option_display_name": "dot info", "label": "methanol sol.", } ] } ] }
then getting error:
variants must have the same list option display names.
and when passing parameters this:
{ "name": "product name", "type": "physical", "sku": "cdid-12345", "description": "description", "weight": 0, "width": 0, "depth": 0, "height": 0, "price": 0, "cost_price": 0, "retail_price": 0, "sale_price": 0, "categories": [1], "variants": [ { "cost_price": 0, "price": 0, "weight": 0, "sku": "mp091236", "option_values": [ { "option_display_name": "size", "label": "1l glass amber", }, { "option_display_name": "self life", "label": "", }, { "option_display_name": "dot info", "label": "", } ] }, { "cost_price": 0, "price": 0, "weight": 0, "sku": "mp091239", "option_values": [ { "option_display_name": "size", "label": "500ml glass amber", }, { "option_display_name": "self life", "label": "12", }, { "option_display_name": "dot info", "label": "methanol sol.", } ] } ] }
then getting error this:
"variants.0.option_values.1.label": "label must string"
how can create 2 skus of product 1 have options size , self life , dot info , other having size option.
in case seems want self life
, dot info
non required modifiers instead rather options
basically create 2 variants each having option values shown below on above endpoint
"variants": [ { ... "option_values": [ { "option_display_name": "size", "label": "1l glass amber", } ] } { ... "option_values": [ { "option_display_name": "size", "label": "500ml glass amber", } ] }
and create 2 modifiers (one display_name
: self life
other display_name
: dot info
) posting twice on v3/catalog/products//modifiers
Comments
Post a Comment