chec / commercejs-nextjs-demo-store

Commerce demo store built for the Jamstack. Built with Commerce.js, Next.js, and can be one-click deployed to Netlify. Includes product catalog, customer login, categories, variants, cart, checkout, payments (Stripe) order confirmation, and printable receipts.
https://commercejs-demo-store.netlify.app/
BSD 3-Clause "New" or "Revised" License
1.07k stars 206 forks source link

Product count missing in sidebar category menu on product list page #174

Closed ltfschoen closed 3 years ago

ltfschoen commented 3 years ago

In this PR, the product count was removed from the categories menu in the sidebar of the product list per category page https://github.com/chec/commercejs-nextjs-demo-store/pull/166

It would be nice if the product count associated with each category was "automatically" shown correctly in the UI, otherwise it's just a nightmare for developers and website owners that want to use that feature, because whenever a user adds or removes one or more products (whether a developer adding/removing products in the products.json seed data or via the API, or the website owner adding/removing a product in the chec.io CMS), then each time they do that they have to notify the developer to "manually" re-count how many products are associated with each category and update the file commercejs-nextjs-demo-store/lib/collections.js, and then push that file to production.

So in my opinion, it should be updated "automatically" so it's shown correctly in the UI every time.

@robbieaverill has indicated that we'd need to expose the number of products available in a category via our Categories API (internal reference: 1053) Note: I'm using this repo (Next.js)

robbieaverill commented 3 years ago

Agreed. As noted, the change to support this will be released tomorrow. We can then add the logic back in using the products count (int) on a category object.