Skip to content

Fix faulty truthiness check for cart quantity - #2855

Merged
blittle merged 3 commits into
Shopify:mainfrom
frontsideair:empty-cart-zero-truthiness
Apr 11, 2025
Merged

Fix faulty truthiness check for cart quantity#2855
blittle merged 3 commits into
Shopify:mainfrom
frontsideair:empty-cart-zero-truthiness

Conversation

@frontsideair

@frontsideair frontsideair commented Apr 11, 2025

Copy link
Copy Markdown
Contributor

WHY are these changes introduced?

When cart is empty, there's a rogue zero shown, while it should be empty instead.

WHAT is this pull request doing?

Fixes the faulty truthiness check, if the quantity is zero, React just shows it, but it shouldn't show anything actually, so a ternary with a false is used instead.

HOW to test your changes?

Post-merge steps

Checklist

  • I've read the Contributing Guidelines
  • I've considered possible cross-platform impacts (Mac, Linux, Windows)
  • I've added a changeset if this PR contains user-facing or noteworthy changes
  • I've added tests to cover my changes
  • I've added or updated the documentation

If the quantity is 0, 0 shown on the screen, while ideally nothing
should be shown.
Comment thread templates/skeleton/app/components/CartMain.tsx Outdated
Co-authored-by: Bret Little <bret.little@gmail.com>
@juanpprieto
juanpprieto requested a review from Copilot April 11, 2025 17:50

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Copilot reviewed 1 out of 1 changed files in this pull request and generated no comments.

juanpprieto
juanpprieto previously approved these changes Apr 11, 2025
@juanpprieto
juanpprieto dismissed their stale review April 11, 2025 17:53

missing changeset

@juanpprieto

Copy link
Copy Markdown
Contributor

Please add a patch changeset for skeleton, cli-hydrogen and create-hydrogen

@frontsideair

Copy link
Copy Markdown
Contributor Author

@juanpprieto Let me know if you need more details, otherwise it should be ready!

@blittle
blittle merged commit 18483c6 into Shopify:main Apr 11, 2025
juanpprieto pushed a commit that referenced this pull request Sep 17, 2025
* Fix faulty truthiness check for cart quantity

If the quantity is 0, 0 shown on the screen, while ideally nothing
should be shown.

* Null to false

Co-authored-by: Bret Little <bret.little@gmail.com>

* Add changesets

---------

Co-authored-by: Bret Little <bret.little@gmail.com>
frandiox pushed a commit that referenced this pull request Jun 16, 2026
* Fix faulty truthiness check for cart quantity

If the quantity is 0, 0 shown on the screen, while ideally nothing
should be shown.

* Null to false

Co-authored-by: Bret Little <bret.little@gmail.com>

* Add changesets

---------

Co-authored-by: Bret Little <bret.little@gmail.com>
marcospassos pushed a commit to croct-tech/croct-hydrogen-project that referenced this pull request Jul 16, 2026
* Fix faulty truthiness check for cart quantity

If the quantity is 0, 0 shown on the screen, while ideally nothing
should be shown.

* Null to false

Co-authored-by: Bret Little <bret.little@gmail.com>

* Add changesets

---------

Co-authored-by: Bret Little <bret.little@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants