Product uniqueness not working as expected #552
Replies: 1 comment
-
So The easiest way to force a unique order line would be to pass a value in the properties collection with a random generated guid and then pass the alias of that property into the var uniquenessPropertyAliases = new[]{ "myUnique" };
var props = new Dictionary<string, string> {
{ "myUnique", Guid.NewGuid().ToString() }
};
// TODO: Merge props with postModel.ExtraProperties
order.AddProduct(postModel.ProductReference, postModel.ProductVariantReference, 1,
props, null, null, uniquenessPropertyAliases, productService); You could probably also simplify this a little by definning the uniqueness property aliases on the store admin screen. This would just save you having to define them manually every time. var props = new Dictionary<string, string> {
{ "myUnique", Guid.NewGuid().ToString() }
};
// TODO: Merge props with postModel.ExtraProperties
order.AddProduct(postModel.ProductReference, postModel.ProductVariantReference, 1, props); |
Beta Was this translation helpful? Give feedback.
-
I'm trying to use the Product Uniqueness Property Aliases, but it is not working, maybe because I'm not using it correctly.
I would like to have a new order line for each product, even if it is the same.
In the current behaviour, what is happening is that after adding a product a new order line is created then when adding the same product again the product is being added, however the original product property value is cleared and the line quantity is updated with the total for both products with a single order line.
This is what I'm trying to implement:
What I've done to try to get this working:
I tried with the "updateDate" from the node and try to play with it, it didn't wort.
I tried with a text property in the product node "test" and I'm changing the value after I add the product to the cart.
If I add a "bundleId" then it creates a new line as I want, but I don't need a bundle.
Ideas?
Thanks!
Expected behaviour
2 cart lines, for the same product.
Beta Was this translation helpful? Give feedback.
All reactions