Skip to content

Add stock informations on cart page#919

Merged
tblivet merged 7 commits intoPrestaShop:developfrom
tblivet:feat/add-stock-on-cart-and-listing
Feb 9, 2026
Merged

Add stock informations on cart page#919
tblivet merged 7 commits intoPrestaShop:developfrom
tblivet:feat/add-stock-on-cart-and-listing

Conversation

@tblivet
Copy link
Contributor

@tblivet tblivet commented Jan 30, 2026

Questions Answers
Description? Add stock informations on cart page + refactor delivery informations
Type? improvement
BC breaks? --
Deprecations? --
Fixed ticket? #839
Sponsor company @PrestaShopCorp
How to test? --

NOTE: this PR should be test with PrestaShop/PrestaShop#40653 and PrestaShop/PrestaShop#40673 and PrestaShop/PrestaShop#40662

This PR is only a POC to display stock information on the cart page. Core-side changes will be required to properly implement it.

This is a preview of what could be achieved if the core is adapted. I have identified some issues with error messages returned by the core. For example, when a product in the cart is no longer in stock, the current message is something like:
"You can only add 0 qty of this product."

A more appropriate message would be something like:
"Please remove the product (XXX) from the cart." when the available quantity is ≤ 0.

Capture d’écran 2026-01-30 à 11 30 45

@Touxten
Copy link
Contributor

Touxten commented Jan 30, 2026

Good start.
On my website, I have an additional display for items that can be ordered if they are out of stock.
Let's imagine an item with 3 pieces in stock. If the customer orders 4 in their cart, I display 3/4 in orange in your example.

@Hlavtox
Copy link
Contributor

Hlavtox commented Jan 30, 2026

@tblivet @Touxten I will make a POC on core. Also handling the partial cases where you order 4 and only 3 are in stock.

@Hlavtox
Copy link
Contributor

Hlavtox commented Jan 31, 2026

@Touxten @tblivet PR ready - PrestaShop/PrestaShop#40653

@Touxten
Copy link
Contributor

Touxten commented Feb 2, 2026

@tblivet

For example, when a product in the cart is no longer in stock, the current message is something like:
"You can only add 0 qty of this product."

Fixed by : PrestaShop/PrestaShop#40662

@tblivet
Copy link
Contributor Author

tblivet commented Feb 2, 2026

Hi @Hlavtox @Touxten, thanks for your work 🙏 I’ll try to have a look at this during the day. Just one thing: I believe both PRs should be pointed to 9.1.x. The one from @Hlavtox is pointed to 9.1.x, but yours @Touxten is pointed to 9.0.x. Ideally, this should be available for 9.1.0 at the same time we release Hummingbird 2.0.0 !

@Touxten
Copy link
Contributor

Touxten commented Feb 2, 2026

My PR fixes an existing issue, while Daniel's adds new features.

So my fix will arrive when 9.0.x is merged into 9.1.x.

@Hlavtox
Copy link
Contributor

Hlavtox commented Feb 2, 2026

@tblivet Good, let me know what you think! :-)

And yes, @Touxten PR is a fix for all themes, not related to hummingbird or 9.1.

@tblivet
Copy link
Contributor Author

tblivet commented Feb 2, 2026

@Hlavtox That’s my bad, I messed up in my PR and was using submessage instead of delivery_time. I’ve just pushed a fix 👍

@Hlavtox
Copy link
Contributor

Hlavtox commented Feb 2, 2026

@tblivet The code for delivery is actually a bit more complicated, because the core doesn't provider proper data.

But, it can be simplified both in cart and on product, page, if this PR gets merged - PrestaShop/PrestaShop#40673.

@tblivet
Copy link
Contributor Author

tblivet commented Feb 2, 2026

@Hlavtox OK, you handle all the logic on the PHP side, in fact, it would be much more cleaner in the FO 👍
I’ll update this POC to also update this section and add in the description all the PRs that need to be merged with this one.

@tblivet tblivet force-pushed the feat/add-stock-on-cart-and-listing branch from 0eb4d44 to 190bba1 Compare February 3, 2026 08:57
@tblivet tblivet marked this pull request as ready for review February 5, 2026 08:24
@tblivet tblivet changed the title [POC] Add stock informations on cart page Add stock informations on cart page Feb 5, 2026
ga-devfront
ga-devfront previously approved these changes Feb 5, 2026
@github-project-automation github-project-automation bot moved this to Ready for review in PR Dashboard Feb 5, 2026
Touxten
Touxten previously approved these changes Feb 5, 2026
Copy link
Contributor

@Hlavtox Hlavtox left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

😍😍😍

Copy link
Contributor

@Hlavtox Hlavtox left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

One last tweak, I will reapprove immediately 🙏

And one question @tblivet @ga-devfront - guys, why is there the condition to put hidden? Isn't the block automatically rendered and replaced as a whole? Cannot we just not render it at all if both availability and delivery message is missing?

@tblivet tblivet dismissed stale reviews from Touxten and ga-devfront via 2258cf8 February 5, 2026 09:14
@tblivet
Copy link
Contributor Author

tblivet commented Feb 5, 2026

@Hlavtox I pushed a fix. Is this what you were asking? I’m not 100% sure.

The hidden attribute is for design purposes because the element is always on the page and has a margin. If we don’t use hidden, we’ll end up with a sort of double margin if the block is present but empty, which is something we don’t want.

Without :
Capture d’écran 2026-02-05 à 10 17 34

With hidden :
Capture d’écran 2026-02-05 à 10 17 52

@AureRita AureRita self-assigned this Feb 9, 2026
@ps-jarvis ps-jarvis moved this from Ready for review to To be tested in PR Dashboard Feb 9, 2026
Copy link

@AureRita AureRita left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @

Thank you for your PR, I tested it and it seems to works as you can see :

Image
Capture.video.du.2026-02-09.17-00-48.mp4

Because the PR seems to works as expected, It's QA ✔️

Thank you

@tblivet tblivet merged commit ed906ea into PrestaShop:develop Feb 9, 2026
6 checks passed
@github-project-automation github-project-automation bot moved this from To be tested to Merged in PR Dashboard Feb 9, 2026
@ps-jarvis
Copy link

PR merged, well done!

Message to @PrestaShop/committers: do not forget to milestone it before the merge.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

Archived in project

Development

Successfully merging this pull request may close these issues.

6 participants