How to automatically apply discounts based on cart item count?

Hello,

I am using the Debutify theme and I am trying to get the current cart item count of the customer.

How do I do that?

This is an example page: https://debutifydemo.myshopify.com/products/chaoswen?variant=21139546603579

What I am trying to do is the following:

  1. Get current customer cart Item count after they clicked add to cart
  2. If cart item count 2 set discount cookie to test12
  3. If cart item count 3 or more set discount cookie to test123

How can I do that ? (I want to do that so the discount gets automatically applied)

Is something like that possible ?

You could set the cookie using JavaScript, attaching yourself to whatever event your theme calls when adding an item to the cart.

Mario

How can I find out what/which event is called by the theme when adding an item to the cart?

Getting into the nitty gritty of how to actually implement this is a bit more of an advanced topic. Unvortunately, I don’t have the ressources to dig into this pro bono at the moment.