Proposal for Improving Variable Product API for Adding to Cart #45844
Replies: 5 comments
-
Beta Was this translation helpful? Give feedback.
-
@wavvves thanks for starting the discussion. I hope I've understood your proposal correctly!
If I've got anything wrong please let me know. You mention we already do this for the value of the attribute, so it makes sense to apply the same process to the name. The process should be as similar as possible for both. I like @frosso's suggestion above, supplying |
Beta Was this translation helpful? Give feedback.
-
Related issue #45846 |
Beta Was this translation helpful? Give feedback.
-
Exactly @opr, the kebab-case or, utf8 encoded with dashes (url friendly) should be a safer option for all future usecases. Trying that first would only be a performance choice to encourage and benefit whoever chooses to adopt that. |
Beta Was this translation helpful? Give feedback.
-
Issue created #47792 |
Beta Was this translation helpful? Give feedback.
-
Hi everyone,
Currently, when we try to add a variable product to the cart using the API, there's a bit of confusion around how we name attributes. The API expects the "user-friendly" attribute name (what we see on the
<label>
), but sometimes this doesn't match up with the internal naming system we use in the product markup. This disconnect can cause some problems, especially when we throw special characters into the mix, when building a request to the StoreAPI on the browser (specially if we have to parse HTML to build our request).I'm proposing the following:
So we would be supporting in this case, for
variation[0][attribute]
:Color %f0%9f%96%8d%ef%b8%8f
color-%f0%9f%96%8d%ef%b8%8f
Color 🖍️
Instead of just
Color 🖍️
. This is what we already do for attribute values data.I believe these tweaks will make life easier for developers working with variable products through the Store API.
Looking forward to your input!
Beta Was this translation helpful? Give feedback.
All reactions