refactor(composables): replace isListPrice with hasListPrice #2318
Merged
Maciej D (mdanilowicz) merged 2 commits intomainfrom Mar 9, 2026
Merged
refactor(composables): replace isListPrice with hasListPrice #2318Maciej D (mdanilowicz) merged 2 commits intomainfrom
isListPrice with hasListPrice #2318Maciej D (mdanilowicz) merged 2 commits intomainfrom
Conversation
…useProductPrice`
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
Contributor
There was a problem hiding this comment.
Pull request overview
This PR refactors the pricing-related API surface by introducing hasListPrice in useProductPrice, deprecating (but keeping) isListPrice as an alias, and updating downstream components/docs/tests to use the new name.
Changes:
- Add
hasListPricetouseProductPricereturn type and aliasisListPriceto it with deprecation JSDoc. - Update CMS/base-layer components to use
hasListPricefor list-price (strikethrough) UI. - Update docs and unit tests to reference
hasListPriceinstead ofisListPrice, and add changesets for releases.
Reviewed changes
Copilot reviewed 8 out of 8 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| packages/composables/src/useProductPrice/useProductPrice.ts | Introduces hasListPrice and deprecates/aliases isListPrice in the composable API. |
| packages/composables/src/useProductPrice/useProductPrice.test.ts | Updates assertions and test names from isListPrice to hasListPrice. |
| packages/cms-base-layer/app/components/public/cms/element/CmsElementBuyBox.vue | Switches buy-box price display logic to use hasListPrice. |
| packages/cms-base-layer/app/components/SwProductPrice.vue | Switches product price component display logic to use hasListPrice. |
| packages/cms-base-layer/app/components/SwListingProductPrice.vue | Switches listing price component display logic to use hasListPrice. |
| apps/docs/src/getting-started/e-commerce/prices.md | Updates documentation examples to use hasListPrice. |
| .changeset/every-hotels-hang.md | Declares cms-base-layer patch release for updated components. |
| .changeset/big-shoes-drum.md | Declares composables minor release for new hasListPrice API + isListPrice deprecation. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Björn Meyer (BrocksiNet)
approved these changes
Mar 9, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
closes #2311
This pull request updates the product pricing composable and related components to introduce a new property,
hasListPrice, which indicates whether a product has a list price set. The previously usedisListPriceproperty is now deprecated and aliased tohasListPrice. All relevant usages across documentation, components, and tests have been updated to usehasListPrice, ensuring consistency and preparing for the removal ofisListPricein the future.Composable API changes:
useProductPricenow returnshasListPrice(a boolean indicating if the product has a list price set). The oldisListPriceproperty is deprecated and aliased tohasListPrice; new code should usehasListPrice. (packages/composables/src/useProductPrice/useProductPrice.ts) [1] [2] [3] [4]Component updates:
CmsElementBuyBox,SwListingProductPrice, andSwProductPricehave been updated to usehasListPriceinstead of the deprecatedisListPrice. (packages/cms-base-layer/app/components/public/cms/element/CmsElementBuyBox.vue,packages/cms-base-layer/app/components/SwListingProductPrice.vue,packages/cms-base-layer/app/components/SwProductPrice.vue) [1] [2] [3] [4] [5]Documentation updates:
hasListPriceinstead ofisListPrice. (apps/docs/src/getting-started/e-commerce/prices.md) [1] [2] [3]Test updates:
useProductPricehave been updated to check forhasListPricerather thanisListPrice, and test descriptions have been updated accordingly. (packages/composables/src/useProductPrice/useProductPrice.test.ts) [1] [2] [3] [4] [5]Type and comment updates:
hasListPriceproperty and the deprecation ofisListPrice. (packages/composables/src/useProductPrice/useProductPrice.ts) [1] [2]