Skip to content

Commit

Permalink
chore: quick shop render logic addition
Browse files Browse the repository at this point in the history
  • Loading branch information
jeremyagabriel committed Oct 18, 2024
1 parent 31552dd commit e3eaf72
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions app/components/ProductItem/QuickShop/QuickShop.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -49,22 +49,27 @@ export function QuickShop({
}, [enabledColorSelector, selectedProduct?.id]);

const hasOneVariant = selectedProduct?.variants?.nodes?.length === 1;
const hasOnlyColorOption =
enabledColorSelector &&
selectedProduct?.options?.length === 1 &&
selectedProduct?.options[0].name === COLOR_OPTION_NAME;
const usesAddToCart = hasOneVariant || hasOnlyColorOption;

return qualifiesForQuickShop && selectedVariant ? (
<div
className={`mt-5 transition md:block md:opacity-0 md:group-hover:opacity-100 lg:mt-6 ${
quickShopMobileHidden ? 'max-md:hidden' : ''
}`}
>
{hasOneVariant && (
{usesAddToCart && (
<AddToCart
addToCartText={quickShopSingleText}
className="btn-inverse-dark"
selectedVariant={selectedVariant}
/>
)}

{selectedProduct && !hasOneVariant && (
{selectedProduct && !usesAddToCart && (
<QuickShopOptions
quickShopMultiText={quickShopMultiText}
quickShopMobileHidden={quickShopMobileHidden}
Expand Down

0 comments on commit e3eaf72

Please sign in to comment.