sellflow / sellflow

A beautiful, customizable open-source mobile app template for your Shopify storefront!

Home Page:https://sellflow.com

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

data.shop.shipsToCountries is larger than COUNTRY_CODE

davidkong0987 opened this issue · comments

this solution works for now

  const shipsToCountries = data.shop.shipsToCountries.filter(x=>Object.keys(COUNTRY_CODE).includes(x))
  useEffect(() => {
    if (data) {
      let countryCodes: Array<CountryCode> = [];
      console.log(shipsToCountries)
      if (searchCountry === '') {
        countryCodes = shipsToCountries;
      } else {
        countryCodes = shipsToCountries.filter((item) =>
          COUNTRY_CODE[item].includes(searchCountry),
        );
      }
      setCountryList(countryCodes);
    }
  }, [data, searchCountry]);