'use client'; import { InformationCircleIcon } from '@heroicons/react/24/outline'; import { Checkbox } from 'components/checkbox'; import CoreCharge from 'components/core-charge'; import Price from 'components/price'; import Tooltip from 'components/tooltip'; import { Money, ProductVariant } from 'lib/shopify/types'; import { useSearchParams } from 'next/navigation'; type PriceWithCoreChargeProps = { variants: ProductVariant[]; defaultPrice: Money; }; const PriceWithCoreCharge = ({ variants, defaultPrice }: PriceWithCoreChargeProps) => { const searchParams = useSearchParams(); const variant = variants.find((variant: ProductVariant) => variant.selectedOptions.every( (option) => option.value === searchParams.get(option.name.toLowerCase()) ) ); console.log({ variant }); return (
{variant?.coreCharge?.amount && variant.waiverAvailable ? (
Select this if you do not have a core to return
) : null}
); }; export default PriceWithCoreCharge;