# Best practice/best way to create Shopping Cart

**URL:** <https://community.weweb.io/t/best-practice-best-way-to-create-shopping-cart/6382>\
**Category:** Ask us anything\
**Created:** [January 14, 2024, 9:46am UTC](https://community.weweb.io/t/best-practice-best-way-to-create-shopping-cart/6382 "2024-01-14T09:46:58Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![IKR](https://sea2.discourse-cdn.com/flex016/user_avatar/community.weweb.io/ikr/32/8200_2.png) [@IKR](https://community.weweb.io/u/IKR)\
**Post date:** [January 14, 2024, 9:46am UTC](https://community.weweb.io/t/best-practice-best-way-to-create-shopping-cart/6382/1 "2024-01-14T09:46:58Z")

</div>

Hello together,

i am now so far with my App and need to create in my next step a Add to Cart + Shopping Cart function.

Basically i have 4 product which are static pages and for each the collection is static as well with xano.

Now i really don’t know how to start to create that without Snipcart.

Maybe someone of you has done that before or can give me a basic idea i can start with.

At the moment each product page has a input field for the amount of products and a add to cart button. In a drawer it should show the added products.

Any help and support i would appreciate.

Many thanks in advance

---

<div class="post-metadata">

**Author:** ![Broberto](https://sea2.discourse-cdn.com/flex016/user_avatar/community.weweb.io/broberto/32/5918_2.png) [@Broberto](https://community.weweb.io/u/Broberto)\
**Post date:** [January 14, 2024, 4:51pm UTC](https://community.weweb.io/t/best-practice-best-way-to-create-shopping-cart/6382/2 "2024-01-14T16:51:32Z")

</div>

You mean an array of items that you store in the local storage and (in an ideal world) you do the logic in a backend?

---

<div class="post-metadata">

**Author:** ![mauromequelussi](https://sea2.discourse-cdn.com/flex016/user_avatar/community.weweb.io/mauromequelussi/32/10223_2.png) [@mauromequelussi](https://community.weweb.io/u/mauromequelussi)\
**Post date:** [January 20, 2024, 7:58pm UTC](https://community.weweb.io/t/best-practice-best-way-to-create-shopping-cart/6382/3 "2024-01-20T19:58:22Z")

</div>

[![](https://us1.discourse-cdn.com/flex016/uploads/weweb/original/2X/3/38723006730a37b6a94f8daf9a73599b1a936f7f.jpeg "E-Commerce com NoCode - Aprenda a criar um carrinho de compras com WeWeb") ](https://www.youtube.com/watch?v=8Myqh94AiNQ)

---

<div class="post-metadata">

**Author:** ![Broberto](https://sea2.discourse-cdn.com/flex016/user_avatar/community.weweb.io/broberto/32/5918_2.png) [@Broberto](https://community.weweb.io/u/Broberto)\
**Post date:** [January 21, 2024, 8:43am UTC](https://community.weweb.io/t/best-practice-best-way-to-create-shopping-cart/6382/4 "2024-01-21T08:43:39Z")

</div>

Man I wish your videos were also translated in English, I’d watch them all.

From what I understood, this is not the best idea though. It is a great proof of concept. BUT… If you have many users buying, and a product runs out of stock, without communicating to the backend, you won’t be able to tell and let the user add the item to the cart anyway. The best way would be to do this also with backend, and add the items to the cart based on that.

---

<div class="post-metadata">

**Author:** ![IKR](https://sea2.discourse-cdn.com/flex016/user_avatar/community.weweb.io/ikr/32/8200_2.png) [@IKR](https://community.weweb.io/u/IKR)\
**Post date:** [February 2, 2024, 11:03am UTC](https://community.weweb.io/t/best-practice-best-way-to-create-shopping-cart/6382/5 "2024-02-02T11:03:40Z")

</div>

Thanks guys.

---

<div class="post-metadata">

**Author:** ![IKR](https://sea2.discourse-cdn.com/flex016/user_avatar/community.weweb.io/ikr/32/8200_2.png) [@IKR](https://community.weweb.io/u/IKR)\
**Post date:** [March 18, 2024, 8:48am UTC](https://community.weweb.io/t/best-practice-best-way-to-create-shopping-cart/6382/6 "2024-03-18T08:48:32Z")

</div>

One question regarding here: [https://youtu.be/8Myqh94AiNQ?t=727](https://youtu.be/8Myqh94AiNQ?t=727),  
if i do that, it will update me the quantity by adding the amount at the end.

Example i have this already in the cart  
“quantity”: 32

but in my case if i add the prodduct one more time to cart the result will be  
“quantity”: 321 and not 33

---

<div class="post-metadata">

**Author:** ![IKR](https://sea2.discourse-cdn.com/flex016/user_avatar/community.weweb.io/ikr/32/8200_2.png) [@IKR](https://community.weweb.io/u/IKR)\
**Post date:** [March 18, 2024, 11:44am UTC](https://community.weweb.io/t/best-practice-best-way-to-create-shopping-cart/6382/7 "2024-03-18T11:44:32Z")

</div>

Thats strange,

if i use an other operators it works, but with “+” its not working.  
Did i type it wrong?

![image](https://us1.discourse-cdn.com/flex016/uploads/weweb/original/2X/c/c792c683f1e78aead8900ee3a076fd6049a2abf6.png)

---

<div class="post-metadata">

**Author:** ![dorilama](https://sea2.discourse-cdn.com/flex016/user_avatar/community.weweb.io/dorilama/32/10403_2.png) [@dorilama](https://community.weweb.io/u/dorilama)\
**Post date:** [March 18, 2024, 2:34pm UTC](https://community.weweb.io/t/best-practice-best-way-to-create-shopping-cart/6382/8 "2024-03-18T14:34:55Z")

</div>

one of the values that you are adding is actually a string, use the toNumber formula in the math section to transform the value before the addition

---

<div class="post-metadata">

**Author:** ![IKR](https://sea2.discourse-cdn.com/flex016/user_avatar/community.weweb.io/ikr/32/8200_2.png) [@IKR](https://community.weweb.io/u/IKR)\
**Post date:** [March 18, 2024, 3:22pm UTC](https://community.weweb.io/t/best-practice-best-way-to-create-shopping-cart/6382/9 "2024-03-18T15:22:12Z")

</div>

@dorilama Thanks…

That was it. 🙂
