How to get cart item count?

salexes
New Member
2 0 0

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 ?

0 Likes
r8r
Shopify Expert
1442 158 480

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

Mario

Mario Rader [he] ★ If you want to achieve greatness, stop asking for permission. ★ Studio Mitte
• Meine Antwort war hilfreich? Hinterlass bitte ein Like.
• Meine Antwort hat Dein Problem behoben? Bitte akzeptiere sie als Lösung.
• Ich hab dir etwas erspart? Ich freue ich mich immer über eine kleine Aufmerksamkeit
• Ja, ich biete Shopify-Services & -Entwicklung und freue mich von Dir zu hören!
• Bitte teile einen Link zu der Seite, deren Problem Du in deinem Beitrag beschreibst!

• Yes, I provide Shopify-services & -development. Feel free to get in touch!
• Please share a link to the site, which you refer to in your problem description. This incredibly increases the chances of you receiving a useful answer!
• My answer was useful? Please leave a Like.
• My answer solved your issue? Please accept it as the solution.
• I saved you time or money? I'm always happy to receive a little thank you.
0 Likes
salexes
New Member
2 0 0

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

0 Likes
r8r
Shopify Expert
1442 158 480

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.

Mario Rader [he] ★ If you want to achieve greatness, stop asking for permission. ★ Studio Mitte
• Meine Antwort war hilfreich? Hinterlass bitte ein Like.
• Meine Antwort hat Dein Problem behoben? Bitte akzeptiere sie als Lösung.
• Ich hab dir etwas erspart? Ich freue ich mich immer über eine kleine Aufmerksamkeit
• Ja, ich biete Shopify-Services & -Entwicklung und freue mich von Dir zu hören!
• Bitte teile einen Link zu der Seite, deren Problem Du in deinem Beitrag beschreibst!

• Yes, I provide Shopify-services & -development. Feel free to get in touch!
• Please share a link to the site, which you refer to in your problem description. This incredibly increases the chances of you receiving a useful answer!
• My answer was useful? Please leave a Like.
• My answer solved your issue? Please accept it as the solution.
• I saved you time or money? I'm always happy to receive a little thank you.
0 Likes