#should_merge
10 messages ยท Page 1 of 1 (latest)
Is it possible to use it to have 2 products for one single product on order with should_merge set to false ?
So that it doesn't increment quantity ?
Yes I believe you can do that and it should create a new item intead of updating the quantity ๐
Adrien, can we even use this setting somehow? It is not exposed anywhere in any of the endpoints or services.
I have looked around quickly in core source and it seems it will be set to true anyway.
It's not a big deal if it's not available. I have other workarounds for my use case if not possible.
My use case is custom text for a product which I would store in line-item metadata. Tho it gets complicated if more than one item of a variant is merged in cart.
I will try to workaround this with an array in metadata as I think this will be the simplest. It's little fragile tho.
Little bump ๐
At the moment if no unit price is passed it will be merged true, but if we look at the cart service, line 664, we can see that the current item will be replaced by the existing one if it exists and the metadata of the line item are equal to the existing item otherwise it will create a new line. So if you use the metadata you should get another item created unless the metadata are the same and in the case it will just increase the quantity. Hope it answer your question ๐ค
God damn! Just checked and it works just like that ๐ ๐คฏ They do not merge if different metadata
I have assumed that it won't work due to should_merge true and started to hack my way around that.
Thanks ๐