This commit is contained in:
cond0r 2021-05-28 10:35:36 +03:00
parent 05ee6d2bee
commit bf80e3b4b9
4 changed files with 4 additions and 8 deletions

View File

@ -148,9 +148,8 @@ const ProductView: FC<Props> = ({ product }) => {
loading={loading} loading={loading}
disabled={variant?.availableForSale === false} disabled={variant?.availableForSale === false}
> >
{variant?.isInStock === false && {variant?.availableForSale === false
variant?.availableForSale === false ? 'Not Available'
? 'Sold Out'
: 'Add To Cart'} : 'Add To Cart'}
</Button> </Button>
</div> </div>

View File

@ -62,7 +62,6 @@ const normalizeProductVariants = ({ edges }: ProductVariantConnection) => {
compareAtPriceV2, compareAtPriceV2,
requiresShipping, requiresShipping,
availableForSale, availableForSale,
quantityAvailable,
}, },
}) => { }) => {
return { return {
@ -73,7 +72,6 @@ const normalizeProductVariants = ({ edges }: ProductVariantConnection) => {
listPrice: +compareAtPriceV2?.amount, listPrice: +compareAtPriceV2?.amount,
requiresShipping, requiresShipping,
availableForSale, availableForSale,
isInStock: Number(quantityAvailable) > 0,
options: selectedOptions.map(({ name, value }: SelectedOption) => { options: selectedOptions.map(({ name, value }: SelectedOption) => {
const options = normalizeProductOption({ const options = normalizeProductOption({
id, id,

View File

@ -34,7 +34,6 @@ const getProductQuery = /* GraphQL */ `
title title
sku sku
availableForSale availableForSale
quantityAvailable
requiresShipping requiresShipping
selectedOptions { selectedOptions {
name name

View File

@ -22,8 +22,8 @@
"@components/*": ["components/*"], "@components/*": ["components/*"],
"@commerce": ["framework/commerce"], "@commerce": ["framework/commerce"],
"@commerce/*": ["framework/commerce/*"], "@commerce/*": ["framework/commerce/*"],
"@framework": ["framework/vendure"], "@framework": ["framework/bigcommerce"],
"@framework/*": ["framework/vendure/*"] "@framework/*": ["framework/bigcommerce/*"]
} }
}, },
"include": ["next-env.d.ts", "**/*.d.ts", "**/*.ts", "**/*.tsx", "**/*.js"], "include": ["next-env.d.ts", "**/*.d.ts", "**/*.ts", "**/*.tsx", "**/*.js"],