fix(core): disable add to cart button when products are out of stock
What/Why?
- Create a shared component for the add to cart button.
- Check for product availability status to show correct text (unavailable, preorder).
- Use
isInStockfrominventoryto 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.
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 |
🦋 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
Can we add a test to verify this?
Good idea, looking into this.
⚡️🏠 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 |