Subtract quantity after purchase

Hi, guys!

I’m making a Virtual Shopping system and getting trouble with subtracting item’s quantity after a purchase is confirmed.

I tried even javascript withToolbox plugin, without success. :confused:

My database:

  • Product (with name, info, amount, etc)
  • Cart (list of Products, amount purchased + other things)

When I try to subtract, I get this:

image

P.s.:

  • “Produto” == Product
  • “Carrinho” == Cart
  • “Quantidade” == Amount

Thanks in advance!!

Hello!

Make sure that your quantidade and estoque are numbers. The expression is red possibly because one of them may not be.

Hi, @cmarchan!

They are! “Quantidade” is a list of numbers that represents the amount of each “Produtcs” included.

And if I try to get the “:item #”, I fail too.

What does the issue checker say? It’s probably to do with either a mismatch in datatype/field type, or mixing up single items with lists. The issue checker will tell you what the issue is.

1 Like

Hi, @adamhholmes!

If I let the way I posted first, the issue checker returns this:

If I use “:first item” or “:sum”, the result is wrong. Cause of this, I tried to use “:item #”. But without success too.

Just to say that I finally managed to solve it using List Shifter Plugin.

List Shifter: Reverse, Rotate, Swap and ITERATE (Loop) Over Bubble Lists | Now at v1.4: Adds Numeric Option, GET INDEX Action - Showcase - Bubble Forum

This topic was automatically closed after 70 days. New replies are no longer allowed.