-
Notifications
You must be signed in to change notification settings - Fork 38
feat(VCST-4164): add-to-cart-simple component in product page #2018
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
982f085
5f2bbb7
24f35bb
585c079
7a80dfa
5222e09
4d83b12
78fe80b
5fc7a84
5b3b461
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -34,15 +34,19 @@ | |
| </div> | ||
|
|
||
| <div class="mt-4 print:hidden"> | ||
| <AddToCart v-if="variationResult && variationResult.price?.actual?.amount > 0" :product="variationResult"> | ||
| <component | ||
| v-if="variationResult && variationResult.price?.actual?.amount > 0" | ||
| :is="product.isConfigurable ? AddToCart : AddToCartSimple" | ||
| :product="variationResult" | ||
| > | ||
| <InStock | ||
| :is-in-stock="variationResult.availabilityData?.isInStock" | ||
| :is-digital="isDigital" | ||
| :quantity="variationResult.availabilityData?.availableQuantity" | ||
| /> | ||
|
|
||
| <CountInCart :product-id="variationResult.id" /> | ||
| </AddToCart> | ||
| </component> | ||
|
|
||
| <div v-else> | ||
| <VcButton | ||
|
|
@@ -97,15 +101,16 @@ | |
| :product="product" | ||
| v-bind="getComponentProps(CUSTOM_PRODUCT_COMPONENT_IDS.PAGE_SIDEBAR_BUTTON)" | ||
| /> | ||
| <AddToCart v-else :product="product"> | ||
|
|
||
| <component v-else :is="product.isConfigurable ? AddToCart : AddToCartSimple" :product="product"> | ||
| <InStock | ||
| :is-in-stock="product.availabilityData?.isInStock" | ||
| :is-digital="isDigital" | ||
| :quantity="product.availabilityData?.availableQuantity" | ||
| /> | ||
|
|
||
| <CountInCart :product-id="product.id" /> | ||
| </AddToCart> | ||
| </component> | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Bug: Missing Component Import Causes Runtime ErrorThe component uses a dynamic component with There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It's imported in line 131: |
||
| </div> | ||
| </template> | ||
| </ProductPriceBlock> | ||
|
|
@@ -134,6 +139,7 @@ import CountInCart from "./count-in-cart.vue"; | |
| import InStock from "./in-stock.vue"; | ||
| import ProductPriceBlock from "./product-price-block.vue"; | ||
| import type { MoneyType, PriceType, Product } from "@/core/api/graphql/types"; | ||
| import AddToCartSimple from "@/shared/cart/components/add-to-cart-simple.vue"; | ||
| import VcAlert from "@/ui-kit/components/molecules/alert/vc-alert.vue"; | ||
|
|
||
| interface IProps { | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Bug: Incorrect Component Selection for Variations
On line 39, the component is selected based on
product.isConfigurable, but the actual product being passed isvariationResult(line 40). When rendering a selected variation, the component choice should be based on whether the variation itself is configurable (variationResult.isConfigurable), not whether the parent product is configurable. Since variations are typically not configurable, this will incorrectly use AddToCart for non-configurable variations when the parent product is configurable.