Skip to content

Commit

Permalink
Merge pull request #446 from commercelayer/fix/country-lock-with-digi…
Browse files Browse the repository at this point in the history
…tal-sku

fix: Filters line items by type on country lock
  • Loading branch information
acasazza authored Nov 3, 2023
2 parents 97a8230 + 171b6fd commit fa207f5
Showing 1 changed file with 11 additions and 4 deletions.
15 changes: 11 additions & 4 deletions packages/react-components/src/utils/addressesManager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -91,10 +91,17 @@ export function countryLockController({
shippingAddressId,
lineItems
}: CountryLockControllerProps): boolean {
const doNotShipItems = lineItems?.every(
// @ts-expect-error no type for do_not_ship on SDK
(lineItem) => lineItem?.item?.do_not_ship === true
)
const doNotShipItems = lineItems
?.filter(
(lineItem) =>
lineItem?.item?.type != null &&
['skus', 'bundles'].includes(lineItem?.item?.type)
)
?.every(
(lineItem) =>
// @ts-expect-error no type for do_not_ship on SDK
lineItem?.item?.do_not_ship === true
)
if (doNotShipItems) return false
if (
countryCodeLock &&
Expand Down

0 comments on commit fa207f5

Please sign in to comment.