How to Expand Cart Items into a List Based on Quantity in Bubble?

Hi everyone,

I’m working on a Bubble app where users can add items to a cart with specific quantities. For example:

  • Cart A: Quantity = 2
  • Cart B: Quantity = 3

I want to expand these cart items into a single list based on their quantities, like this:
[“Cart A”, “Cart A”, “Cart B”, “Cart B”, “Cart B”]

This expanded list will later be used in a repeating group or other workflows.

What I’ve Tried :

    1. Is it possible to dynamically expand cart items into a list using only custom states in Bubble?
  1. I understand that Bubble doesn’t natively support advanced array manipulation, so I’m wondering if there’s a way to achieve this using Bubble’s built-in tools (e.g., workflows, custom states) or plugins like Toolbox.

Specific Questions :

  1. What’s the best way to dynamically expand cart items into a list based on their quantities?
  2. Can this be achieved without using plugins? If not, which plugin would be most suitable for this task?

Expected Outcome :

A list like ["Cart A", "Cart A", "Cart B", "Cart B", "Cart B"] that I can use in a repeating group or other workflows.

Thanks in advance for your help!

You won’t be able to add the same item to a list more than once.

To handle this, you should create a new table (e.g., Item_Cart) that includes both the item and its quantity. Then, instead of adding the item directly to the cart, you would add an Item_Cart entry. This way, you can manage the quantity of each item within the cart more effectively.

1 Like

Yes, or you can have a text data type where you manually add/delete Id1, Id1, Id2, Id2, Id2 etc. via string operations, and then split that text by comma to get the IDs and then display them wherever you want.