Open HuyPham55 opened 1 year ago
Hmm looks like "Condition on Per-Item Bases" is just for that.. it is right there in the Readme. You can apply it on add, or later:
Add condition to existing Item on the cart: Cart::addItemCondition($productId, $itemCondition)
Works fine for me. Maybe check if you've given the right $productId
Cheers
Not sure if you've read my question entirely. It's about the quantity of the condition, not how to add condition to a cart item
If you want to achieve this, you should somehow save the second and the third product with different ID, so they won't get under the condition like the first one. But I don't think this could happen for the products under the same ID in the cart.
I would make it with some checks on adding, if the product exists in the cart, to save it with some prefix (or suffix) on the ID. And to apply this condition only on the products that have no suffix. Something like that.
Cheers
If you want to achieve this, you should somehow save the second and the third product with different ID, so they won't get under the condition like the first one. But I don't think this could happen for the products under the same ID in the cart.
I would make it with some checks on adding, if the product exists in the cart, to save it with some prefix (or suffix) on the ID. And to apply this condition only on the products that have no suffix. Something like that.
Cheers
That requires extra work when it comes to display the shopping cart items (adding/subtracting product quantity to be specific) since you are creating a whole new row, while in fact, it's the same product. I just wondering if there is any native way or integrated configuration for that. Thank you anyway
First I'm not sure if this is the right place for discussions/questions Second I want to apply an item condition (Per-Item Bases) only one only one time for a row, is this possible?
For example, I have a row with
quantity = 3
andprice = 200
. However I want to apply an discount (-50) for only the first, the 2 following will have original price, so the subtotal of that row is150+200+200 = 550
.I've read the document thoroughly and tried my luck with
addItemCondition
. But instead it applies to all items in that row so the subtoal ended up being150*3 = 450
.How I am supposed to achieve this?