catalyst icon indicating copy to clipboard operation
catalyst copied to clipboard

fix(core): disable add to cart button when products are out of stock

Open jorgemoya opened this issue 1 year ago • 4 comments

What/Why?

  • Create a shared component for the add to cart button.
  • Check for product availability status to show correct text (unavailable, preorder).
  • Use isInStock from inventory to check if a product/variant is available to be added to cart (when available).
  • Show correct messaging in add to cart buttons when a product is not available/oos.
  • Update translations object.

Testing

Locally the button displays the correct messaging and disabled status.

jorgemoya avatar May 20 '24 18:05 jorgemoya

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
catalyst-latest ✅ Ready (Inspect) Visit Preview 💬 Add feedback May 31, 2024 7:16pm
catalyst-ppr ✅ Ready (Inspect) Visit Preview 💬 Add feedback May 31, 2024 7:16pm
4 Ignored Deployments
Name Status Preview Comments Updated (UTC)
catalyst-1millionproducts-store ⬜️ Ignored (Inspect) Visit Preview May 31, 2024 7:16pm
catalyst-au ⬜️ Ignored (Inspect) Visit Preview May 31, 2024 7:16pm
catalyst-test-store ⬜️ Ignored (Inspect) Visit Preview May 31, 2024 7:16pm
catalyst-uk ⬜️ Ignored (Inspect) Visit Preview May 31, 2024 7:16pm

vercel[bot] avatar May 20 '24 18:05 vercel[bot]

🦋 Changeset detected

Latest commit: 0115d31194a59427e5b0a1c0086bb8da5e67e73c

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
@bigcommerce/catalyst-core Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

changeset-bot[bot] avatar May 20 '24 18:05 changeset-bot[bot]

Can we add a test to verify this?

Good idea, looking into this.

jorgemoya avatar May 20 '24 19:05 jorgemoya

⚡️🏠 Lighthouse report

Lighthouse ran against https://catalyst-latest-2d1rxh3d8-bigcommerce-platform.vercel.app

🖥️ Desktop

We ran Lighthouse against the changes on a desktop and produced this report. Here's the summary:

Category Score
🟢 Performance 98
🟢 Accessibility 100
🟢 Best practices 100
🟢 SEO 90

📱 Mobile

We ran Lighthouse against the changes on a mobile and produced this report. Here's the summary:

Category Score
🟠 Performance 87
🟢 Accessibility 100
🟢 Best practices 100
🟢 SEO 92

github-actions[bot] avatar May 31 '24 19:05 github-actions[bot]