vue-storefront-1
vue-storefront-1 copied to clipboard
Improve the cart product.product_option format
What is the motivation for adding / enhancing this feature?
We're using the product.product_option to provide the backend with the selected product options. Here you have the code which is setting the options right now.
Let's simplify it from:
{
"cartItem":{
"sku":"WS05",
"qty":1,
"product_option":{
"extension_attributes":{
"custom_options":[
],
"configurable_item_options":[
{
"option_id":"93",
"option_value":"56"
},
{
"option_id":"142",
"option_value":"167"
}
],
"bundle_options":[
]
}
},
"quoteId":"587011"
}
}
TO
{
"cartItem":{
"sku":"WS05",
"qty":1,
"option":{
"custom":[
],
"configurable":[
{
"option_id":"93",
"option_value":"56"
},
{
"option_id":"142",
"option_value":"167"
}
],
"bundle":[
]
},
"quoteId":"587011"
}
}
In order to have it still compatible with Magento2 we need to change the new format to old one just before calling the vue-storefront-api endpoint OR change the vue-storefront-api endpoint input format and map the format inside the cart/update.
Please note: changing the API is not recommended as many platform connectors (m1, m2, epi-server ...) are using the old format.
Please note: by any change provided we must support the old format as well!
ps. there is also an product.options property which is presenting the options as they appear to the user. Not sure about the naming :/
Related to vuestorefront/vue-storefront-1#289