-
Notifications
You must be signed in to change notification settings - Fork 1.2k
has_variants=false: disable Generate Variants button and fix the selection attributes in variant's edit/crete
#6298
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
63582c2
aa51822
8fef047
ef037ae
c7afef6
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 |
|---|---|---|
|
|
@@ -309,6 +309,7 @@ export const fragmentVariant = gql` | |
| productType { | ||
| id | ||
| name | ||
| hasVariants | ||
| } | ||
| channelListings { | ||
| id | ||
|
|
||
Large diffs are not rendered by default.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -95,6 +95,8 @@ interface ProductVariantPageProps { | |
| header: string; | ||
| channels: ChannelPriceData[]; | ||
| channelErrors: ProductChannelListingErrorFragment[]; | ||
| /** Whether the product type supports variant attributes */ | ||
| hasVariants: boolean; | ||
| loading?: boolean; | ||
| placeholderImage?: string; | ||
| saveButtonBarState: ConfirmButtonTransitionState; | ||
|
|
@@ -136,6 +138,7 @@ export const ProductVariantPage = ({ | |
| defaultVariantId, | ||
| defaultWeightUnit, | ||
| errors: apiErrors, | ||
| hasVariants, | ||
| header, | ||
| loading, | ||
| placeholderImage, | ||
|
|
@@ -288,7 +291,9 @@ export const ProductVariantPage = ({ | |
| <VariantAttributesSection | ||
| title={intl.formatMessage(messages.nonSelectionAttributes)} | ||
| attributes={nonSelectionAttributes} | ||
| totalAttributesCount={data.attributes.length} | ||
| selectionAttributesExist={selectionAttributes.length > 0} | ||
| hasVariants={hasVariants} | ||
| attributeValues={attributeValues} | ||
| productTypeName={variant.product.productType.name} | ||
| productTypeUrl={productTypeUrl(variant.product.productType.id)} | ||
|
|
@@ -306,7 +311,7 @@ export const ProductVariantPage = ({ | |
| richTextGetters={attributeRichTextGetters} | ||
| /> | ||
| )} | ||
| {selectionAttributes.length > 0 && ( | ||
| {hasVariants && selectionAttributes.length > 0 && ( | ||
| <> | ||
| <CardSpacer /> | ||
|
Comment on lines
+314
to
316
|
||
| <Attributes | ||
|
|
||
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.
productTypeIdis being passed asproduct?.productType.id ?? "". An empty string will makeproductTypeUrl(productTypeId)resolve to/product-types/(list) instead of a specific product type, which is especially confusing now that the disabled Generator tooltip links to product type settings. Prefer not passing a sentinel "" (e.g. renderProductVariantsonly when the id is available, or make the prop optional and hide the link when missing).