web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / Design shopping cart a...
Power Apps
Answered

Design shopping cart and manage items

(0) ShareShare
ReportReport
Posted on by 384

Hi all,

I am building a webshop and I would like to be able to change the quantity of products or remove them from my gallery.

Frankie70_0-1615994026302.png

I can think of two options:

  1. use a dropdown (when choosing '0' is deleting the product from the list
  2. using buttons (up and down arrow) to modify the quantity or put it to '0' for deletion

Currently the dropdown is configured like this:

 

Sequence(ThisItem.Amount+3,0,1)

 

In my gallery the items ar grouped

 

AddColumns(
 GroupBy(
 basket,
 "itemname",
 "itemopt",
 "itemprice",
 "itemname_rec"
 ),
/* "Total", Sum(itemname_rec, itemprice), */
 "Amount",
 Sum(
 itemname_rec,
 itemcount
 )
 
)

 

I am really stuck here and any help is appreciated!

Categories:
I have the same question (0)
  • RandyHayes Profile Picture
    76,299 Super User 2024 Season 1 on at

    @Frankie70 

    I am not sure if you are looking for formulas or just general help on this.

    I would suggest that you NOT automatically remove an item from the list when it is set to 0.  Instead consider a trash can icon with a confirm.  It is annoying for a user to accidentally do something (i.e. clicking the down arrow thinking it was the up arrow) and having an item disappear.  Putting an icon on the line gives them more control that they are doing just that.  Also, if there are 20 items, if they want to delete all 20, they would have to know that they need to click the down arrow 20 times to remove it...a trash can icon is pretty universal for what it means.

    Of course, you can use the dropdown instead, but that again becomes an annoyance if they want to add more than the maximum in your dropdown.

     

    I hope this is helpful for you.

  • Frankie70 Profile Picture
    384 on at

    Hi @RandyHayes 

    Thank you very much for your feedback. This is really helpful. Although if you could help me with some formulas it would be absolutely great. Because I am stuck. Using a drop-down would suit me best. I already tried to remove the grouped item with a trash symbol, but I did not succeed.

  • Frankie70 Profile Picture
    384 on at

    Hi @RandyHayes 

    I am struggeling with changing the amount of a single item in the shopping tray (basket).

    I would like a "-" left of the amount (which will change to a trash icon if the amount is 1) and a "+" right of the amount for increasing the amount.

     

    I'm not quite sure if I'm making a mistake here either. If I change the number of an item in the basket (which is a group), will the number of items in the group really be changed? Any thoughts and ideas will be very helpful for me.

  • RandyHayes Profile Picture
    76,299 Super User 2024 Season 1 on at

    @Frankie70 
    So, if you are incrementing or decrementing values, this would not be at the group level, you would be doing this on an individual item record in that group.  When you do that, yes, the grouping will update.

    But again, no, there is nothing really to change at the group level for this...has to be the records in the group.

     

    Also, you might want to take a look at this post from yesterday where I discussed a process of doing the increment and decrement process in a gallery.  Not sure if helpful, but perhaps in your case.

     

  • Frankie70 Profile Picture
    384 on at

    Hi @RandyHayes 

    thanks for your answer. Could you please provide me some help on this. I do not understand how to use the up and down controls on the group put changing the individual items...

  • RandyHayes Profile Picture
    76,299 Super User 2024 Season 1 on at

    @Frankie70 

    Sure thing...

    I believe what you need to abandon is the items of the Group concept.  Meaning, when you ultimately go to store the information, the basket items will not be used, instead the Gallery is your basket (which it really kind of already is).

     

    BUT, before that, rolling back...why a GroupBy on your items?  Is this somehow related to how you are adding the items to your basket?

  • Frankie70 Profile Picture
    384 on at

    Hi @RandyHayes 

    the groupby just looks a bit more cleaned up.

    And it more comfortable for the user to add or remove.

    Frankie70_0-1616091541786.png

    The items are added like that:

    Collect(
     basket,
     {
     itemname: Gallery4.Selected.Title,
     itemcat: Gallery4.Selected.Category,
     itemprice: Gallery4.Selected.Price,
     itemopt: dd_options_5.Selected.Result,
     itemid: Gallery4.Selected.ID,
     itemcount: "1"
     }
    )

    I added itemcount just recently for testing, because I can not succeed 😞

  • RandyHayes Profile Picture
    76,299 Super User 2024 Season 1 on at

    @Frankie70 

    I am not entirely sure what you concept is on that screen.  It appears that you have a list of items at the top...but they have trash cans on them, so I am not sure how that fits in.  I assume the user clicks the item at the top and it goes into the shopping cart?  which is displayed below?

     

    If that is the case, then here's the thing... you are adding these items row by row.  What you should be doing is (perhaps where you were going) incrementing or decrementing an Item Count on the row.

    This way if someone selects the Lenovo, when they add another one, you should be incrementing the item you have, not adding another row. 

    At that point there is no need for grouping and the complexity it is causing.

    Your cart will have only one item in it and a count of how many are desired.

     

     

     

  • Frankie70 Profile Picture
    384 on at

    Hi @RandyHayes 

    I'm sorry that confused you.

    I just put the "old" ungrouped shopping cart at the top and the "new" grouped one at the bottom.

    The shop where you choose the products is on another screen.

    Here:

    Frankie70_1-1616100627157.png

     

    So, I would like only to have the "new" grouped view of the shopping cart where you are able to increase and decrease the number of grouped products (or even delete them when the number is down to 1, the arrow down will be a trash icon).

    I hope this expains now, what my plans are.

  • RandyHayes Profile Picture
    76,299 Super User 2024 Season 1 on at

    @Frankie70 

    Very good.  So then the concept is this, on your Add to Cart, check your collection to see if the item is already in the cart.  If so, increment the count.  If not, add it and set the count to 1.

    This will totally eliminate the need to group by anything as it will then automatically be grouped.

     

     

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Season of Sharing Community Challenge Winners!

Congratulations to our community stars!

Kudos to our 2025 Community Spotlight Honorees

Expanding mentorship, skilling, and AI innovation

Congratulations to the July Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 329 Most Valuable Professional

#2
11manish Profile Picture

11manish 209 Super User 2026 Season 2

#3
Mohsin Ali Profile Picture

Mohsin Ali 179

Last 30 days Overall leaderboard