Skip to content

refactor(composables): replace isListPrice with hasListPrice #2318

Merged
Maciej D (mdanilowicz) merged 2 commits intomainfrom
fix/GH-2311
Mar 9, 2026
Merged

refactor(composables): replace isListPrice with hasListPrice #2318
Maciej D (mdanilowicz) merged 2 commits intomainfrom
fix/GH-2311

Conversation

@mdanilowicz
Copy link
Contributor

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 used isListPrice property is now deprecated and aliased to hasListPrice. All relevant usages across documentation, components, and tests have been updated to use hasListPrice, ensuring consistency and preparing for the removal of isListPrice in the future.

Composable API changes:

  • useProductPrice now returns hasListPrice (a boolean indicating if the product has a list price set). The old isListPrice property is deprecated and aliased to hasListPrice; new code should use hasListPrice. (packages/composables/src/useProductPrice/useProductPrice.ts) [1] [2] [3] [4]

Component updates:

  • Components CmsElementBuyBox, SwListingProductPrice, and SwProductPrice have been updated to use hasListPrice instead of the deprecated isListPrice. (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:

  • All code examples and references in the documentation have been updated to use hasListPrice instead of isListPrice. (apps/docs/src/getting-started/e-commerce/prices.md) [1] [2] [3]

Test updates:

  • Unit tests for useProductPrice have been updated to check for hasListPrice rather than isListPrice, and test descriptions have been updated accordingly. (packages/composables/src/useProductPrice/useProductPrice.test.ts) [1] [2] [3] [4] [5]

Type and comment updates:

  • Types and JSDoc comments have been updated to reflect the new hasListPrice property and the deprecation of isListPrice. (packages/composables/src/useProductPrice/useProductPrice.ts) [1] [2]

@vercel
Copy link

vercel bot commented Mar 8, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
frontends-starter-template-extended Ready Ready Preview, Comment Mar 8, 2026 11:14am
frontends-vue-starter-template Ready Ready Preview, Comment Mar 8, 2026 11:14am
old-frontends-demo Ready Ready Preview, Comment Mar 8, 2026 11:14am
shopware-frontends-docs Ready Ready Preview, Comment Mar 8, 2026 11:14am

Request Review

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

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 hasListPrice to useProductPrice return type and alias isListPrice to it with deprecation JSDoc.
  • Update CMS/base-layer components to use hasListPrice for list-price (strikethrough) UI.
  • Update docs and unit tests to reference hasListPrice instead of isListPrice, 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.

@mdanilowicz Maciej D (mdanilowicz) merged commit b40305f into main Mar 9, 2026
11 checks passed
@mdanilowicz Maciej D (mdanilowicz) deleted the fix/GH-2311 branch March 9, 2026 08:15
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.

[BUG] [COMPOSABLES] isListPrice calculation is wrong

3 participants