Giter VIP home page Giter VIP logo

Comments (4)

Blum avatar Blum commented on June 18, 2024

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

from laravelshoppingcart.

HuyPham55 avatar HuyPham55 commented on June 18, 2024

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

from laravelshoppingcart.

Blum avatar Blum commented on June 18, 2024

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

from laravelshoppingcart.

HuyPham55 avatar HuyPham55 commented on June 18, 2024

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

from laravelshoppingcart.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.