Skip to content

Commit cada5f4

Browse files
Don't pass variants filter for treatment variations
1 parent 989f420 commit cada5f4

File tree

1 file changed

+7
-8
lines changed

1 file changed

+7
-8
lines changed

client/my-sites/checkout/src/components/wp-order-review-line-items.tsx

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ import { getAffiliateCouponLabel } from '../../utils';
3535
import { AkismetProQuantityDropDown } from './akismet-pro-quantity-dropdown';
3636
import { ItemVariationPicker } from './item-variation-picker';
3737
import type { OnChangeAkProQuantity } from './akismet-pro-quantity-dropdown';
38-
import type { OnChangeItemVariant } from './item-variation-picker';
38+
import type { OnChangeItemVariant, WPCOMProductVariant } from './item-variation-picker';
3939
import type {
4040
ResponseCart,
4141
RemoveProductFromCart,
@@ -387,8 +387,7 @@ function LineItemWrapper( {
387387
const isJetpack = responseCart.products.some( ( product ) =>
388388
isJetpackPurchasableItem( product.product_slug )
389389
);
390-
391-
const variants = useGetProductVariants( product, ( variant ) => {
390+
const variantsFilterCallback = ( variant: WPCOMProductVariant ) => {
392391
// Only show term variants which are equal to or longer than the variant that
393392
// was in the cart when checkout finished loading (not necessarily the
394393
// current variant). For WordPress.com only, not Jetpack, Akismet or Marketplace.
@@ -403,12 +402,12 @@ function LineItemWrapper( {
403402
return true;
404403
}
405404

406-
if ( isStreamlinedPrice ) {
407-
return true;
408-
}
409-
410405
return variant.termIntervalInMonths >= initialVariantTerm;
411-
} );
406+
};
407+
const variants = useGetProductVariants(
408+
product,
409+
! isStreamlinedPrice ? variantsFilterCallback : undefined
410+
);
412411

413412
const areThereVariants = variants.length > 1;
414413

0 commit comments

Comments
 (0)