Skip to main content
Question

Is it possible to carry variables through multiple levels (adding items to cart)


Tymniak

I know the title is a bit confusing, but I will unfold the question bit by bit, maybe more people have the same questions:

So I am trying to build an e-commer, and inside the product there are multiple procut options, from colors to models.

This gets me to do the following(Sorry, Figma only allows 1 print for starter users, but I can clarify further with prints on the comments):

  1. Carry the chosen model/color to the quantity selector
    image

  2. Change the total available amount as the selected amount is increased or decreased (I know this is possible, but how can I do this with multiple models, each one with its own counting?)

  3. Then carry the set amount via quantity selector to the button “Add to cart” (so it could be properly launched to the cart)

  4. Then have the exact model of the product and its model/color and quantity to show up on the cart

  5. Then carry the cart products, its model, price and quantity along to the checkout (pricing, adding shipment value etc.)

  6. Carrying the entire purchase data into the “Check my purchase”

  7. Carrying the purchase data to a possible editing and then saving the edited changes to be recorded on the purchase screen.

So far, I’ve seen people doing such operations only in a 1-level structure, so to speak, clicking “+” to launch the product into the cart, then incrementing the quantity inside the shopping cart, though I couldn’t seem to find any tutorial/fellow designer nor thread discussing such possibility, so I resorted to the attempt on asking it myself.

Thanks y’all!

2 replies

Vishal_Ramawat

5 models = 5 variables
5 Prices = 5 variables (optional)
1 variable for quantity
1 variable for amount
OnClick of 1st Model, set varQty = 0
In/Decrement Quantity using +/-
OnClick Add to Cart:

  • set varModel(n) Quantity = varQty
  • set varAmount = varAmount + ([varModel(n) price] * varQty)
  • set varQty = 0

So everytime yo u click add to cart, you decide the Model, pick the quantity, add to amount and then reset the Quantity Selector.


Tymniak
  • Author
  • 1 reply
  • May 4, 2024

This was very insightful. Appreciate your attention and will try it out right away.
If any trouble and/or some contribution to add, I’ll revive this thread.

Thanks again and have a lovely weekend! 🙂


Reply


Cookie policy

We use cookies to enhance and personalize your experience. If you accept you agree to our full cookie policy. Learn more about our cookies.

 
Cookie settings