Update product update page
This commit is contained in:
parent
2d9385554b
commit
cdfac6de6b
2 changed files with 17 additions and 11 deletions
|
@ -159,7 +159,7 @@ export const ProductUpdatePage: React.FC<ProductUpdatePageProps> = ({
|
|||
|
||||
const categories = getChoices(categoryChoiceList);
|
||||
const collections = getChoices(collectionChoiceList);
|
||||
const currency = maybe(() => product.basePrice.currency);
|
||||
const currency = maybe(() => product.variants[0].price.currency);
|
||||
const hasVariants = maybe(() => product.productType.hasVariants, false);
|
||||
|
||||
const handleSubmit = (data: ProductUpdatePageFormData) => {
|
||||
|
@ -246,19 +246,25 @@ export const ProductUpdatePage: React.FC<ProductUpdatePageProps> = ({
|
|||
/>
|
||||
)}
|
||||
<CardSpacer />
|
||||
<ProductPricing
|
||||
currency={currency}
|
||||
data={data}
|
||||
disabled={disabled}
|
||||
errors={errors}
|
||||
onChange={change}
|
||||
/>
|
||||
<CardSpacer />
|
||||
{!!product?.productType && !hasVariants && (
|
||||
<>
|
||||
<ProductPricing
|
||||
currency={currency}
|
||||
data={data}
|
||||
disabled={disabled}
|
||||
errors={errors}
|
||||
onChange={change}
|
||||
/>
|
||||
<CardSpacer />
|
||||
</>
|
||||
)}
|
||||
{hasVariants ? (
|
||||
<ProductVariants
|
||||
disabled={disabled}
|
||||
variants={variants}
|
||||
fallbackPrice={product ? product.basePrice : undefined}
|
||||
fallbackPrice={
|
||||
product ? product.variants[0].price : undefined
|
||||
}
|
||||
onRowClick={onVariantShow}
|
||||
onVariantAdd={onVariantAdd}
|
||||
onVariantsAdd={onVariantsAdd}
|
||||
|
|
|
@ -188,7 +188,7 @@ export function getProductUpdatePageFormData(
|
|||
variants: ProductDetails_product_variants[]
|
||||
): ProductUpdatePageFormData {
|
||||
return {
|
||||
basePrice: maybe(() => product.basePrice.amount, 0),
|
||||
basePrice: maybe(() => product.variants[0].price.amount, 0),
|
||||
category: maybe(() => product.category.id, ""),
|
||||
chargeTaxes: maybe(() => product.chargeTaxes, false),
|
||||
collections: maybe(
|
||||
|
|
Loading…
Reference in a new issue