UNPKG

@unchainedshop/plugins

Version:

Official plugin collection for the Unchained Engine with payment, delivery, and pricing adapters

13 lines (12 loc) 565 B
export default function isDeliveryAddressInCountry({ orderDelivery, order, countryCode: forceCountryCode = null, }, allowedCountryCodes) { let countryCode = forceCountryCode?.toUpperCase().trim() || order?.countryCode; if (orderDelivery || order) { const address = orderDelivery?.context?.address || order?.billingAddress; if (address?.countryCode > '') { countryCode = address.countryCode?.toUpperCase().trim(); } } if (!countryCode) return false; return allowedCountryCodes.includes(countryCode); }