Frete geoip

Detalhes

Nos dedicamos a proporcionar a melhor experiência de compra na sua loja. Por isso, implementamos um script de GeoIP que exibe as taxas de frete personalizadas com base na localização dos seus clientes. Com esse recurso, seus clientes visualizarão informações de frete específicas para sua região, garantindo uma experiência de compra mais eficiente e transparente.

Esse script funciona em qualquer tema shopify 2.0

1 - Criar snippet (frete-geoip)

				
					<style>
.frete-geoip {
  display: flex;
  flex-direction: row;
  gap: 8px;
  align-items: center;
  justify-content: flex-start;
  margin-top: {{ block.settings.margin_top_estimativa_de_entrega }}px;
  margin-bottom: {{ block.settings.margin_bottom_estimativa_de_entrega }}px;
}

.selos-frete-modelo-1 {
  margin-bottom: {{ block.settings.margin_bottom_selos_estimativa_de_entrega }}px;
}

.frete-geoip-text {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
}

.frete-geoip-text p {
  margin:-0.5px;
  color: {{ block.settings.cor_do_texto }};
  font-size: 13px;
}

.selos-frete-modelo-1 .text-badge span,
.selos-frete-modelo-1 .text-badge b {
  color: {{ block.settings.cor_do_titulo_selos }};
}

#badges-product {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  flex-direction: column;
  width: 100%;
  color: rgba(0, 0, 0, 0.55);
}

#badges-product p {
  margin: 0;
  padding: 0;
}

#badges-product .badge-block {
  display: flex;
  align-items: flex-start;
  justify-content: start;
  width: 100%;
}

#badges-product .badge-block .badge-icon {
  margin-right: 10px;
  margin-top: 5px;
}

#badges-product .badge-block .badge-text {
  flex: 1;
  font-size: 14px;
  color: {{ block.settings.cor_do_texto }};
}

#badges-product .badge-block svg {
  color: {{ block.settings.cor_do_icone }};
  fill: {{ block.settings.cor_do_icone }};
  stroke: unset;
  width: 16px;
  height: auto;
}

@media screen and (max-width: 400px) {
.shipping-estimated {
  font-size: 12px !important;
}
}
</style>

<div data-frete-geoip {{ block.shopify_attributes }}>
<div class="frete-geoip">

  {%- if block.settings.logo_estimativa_de_entrega == 'aviao' -%}
    <svg xmlns="http://www.w3.org/2000/svg" xml:space="preserve" width="36" height="24" style="shape-rendering:geometricPrecision;text-rendering:geometricPrecision;fill-rule:evenodd;clip-rule:evenodd;width:36px;height:24px;color:#333333;" viewBox="0 0 100.25 42.71"><path d="M33.64 31.45c55.99-16.41-1.17.34 57.18-16.75 4.19-1.23 7.65-3.27 9.2-7.22.01-.03.02-.05.03-.07.29-.97.34-1.02-.41-1.51-.13-.08-.21-.12-.35-.18-3.12-1.39-6.19-1.69-9.22-1.36-.37.04-.54.06-.91.17-25.02 7.36.24-.07-25.25 7.43-2.99.16-18.88-7.51-24.23-9.79-7.97-3.39-15.79-3.88-6.49 6.48l1.84 1.92c7.5 7.8 8.13 8.23 1.82 9.96-7.88 2.15-15.34 3.83-23.06 6.43-.95.32 14.43 6.08 19.85 4.49z" style="fill:#474747"></path><path d="m12.74 25.92 8.68-2.69s-9.98-6.92-11.29-8.09c-.07-.07-.06-.09-.16-.09-2.36-.09-.48-.02-2.99-.12-1.06-.04-.92.19-.37.93 2.66 3.57 4.01 6.18 6.13 10.06z" style="fill:#494946"></path><path d="m29.88 12.53 11.09-3.17c1.83-.53 3.71-.42 4.19.23.48.65-.61 1.6-2.44 2.12l-11.08 3.17c-1.84.53-3.71.42-4.2-.23-.48-.65.61-1.6 2.44-2.12zm-27.31 5.5 11.11-3.09c1.83-.51 3.71-.39 4.19.26.48.66-.62 1.6-2.46 2.11L4.3 20.4c-1.83.51-3.71.39-4.19-.26-.48-.66.62-1.6 2.46-2.11zm10.2 10.11 11.04-3.33c1.82-.55 3.7-.47 4.2.17.49.64-.59 1.61-2.42 2.16l-11.03 3.33c-1.83.55-3.71.47-4.2-.17-.49-.64.59-1.61 2.41-2.16zM5.73 40.01l10.98-3.51c1.82-.58 3.7-.54 4.2.09.5.64-.56 1.62-2.38 2.2L7.56 42.31c-1.82.58-3.7.53-4.2-.1-.51-.64.56-1.62 2.37-2.2z" style="fill:#0697da"></path></svg>
  {%- endif -%}

  {%- if block.settings.logo_estimativa_de_entrega == 'moto' -%}
    <svg xmlns="http://www.w3.org/2000/svg" xml:space="preserve" width="34" height="28" style="shape-rendering:geometricPrecision;text-rendering:geometricPrecision;fill-rule:evenodd;clip-rule:evenodd;width:34px;height:28px;color:#333333;" viewBox="0 0 224.09 169.14"><defs><style>.fil0-delivery{fill:#333 !important}</style></defs><g id="Camada_x0020_1"><g id="_2443115716864"><path class="fil0-delivery" d="M147.93 57c.52 2.24 2.06 5.44 3.09 7.66 1.61 3.44 3.36 3.45 7.31 3.9 4.34.49 17.55.83 19.97 1.99.76 1.59 1.92 18.66 1.9 21.97-.05 6.9-1.4 15.29-2.93 20.93-1.72 6.31-4.46 10.97-8.66 15.17-5.4 5.38-8.8 4.98-16.95 6.88 2.09-4.35 14.96-35.3 14.96-38.78 0-7.88-7.06-8.99-12.95-11.35l-17.42-6.87c1.16-4.99 8.73-18.11 11.68-21.5zm-36.92 28.04c0 4.44 2.07 5.45 3.74 7.94l-38.68.11c-2.25.59-1.81 1.88-1.59 4.12.2 2.01.01 4.65 1.96 4.65h57c2.57 0 2.34-.78 2.34-3.27l13.05 3.83c-.21 2.75-5.66 20.06-7.18 25.4-.93 3.24-1.2 7.68-4 7.68-22.72 0-14.8-14.98-7.68-26.37.62-.98 3.76-4.94.67-4.94H78.77c-1.5 0-1.24 1.07-2.59 1.61-1.2.48-3 .28-4.41.27-6.44-.07-22.6-.79-26.17.93-1.27 5.44-.88 4.23 12.62 4.2 5.21-.01 9 .47 14.48.47-1.26 1.1-7.88 4.17-10.25 4.23l-29.46-.02c-4.91 0-11.69-1.44-11.69 3.27 0 2.77 4.79 1.87 7.48 1.87h28.97c-3.3 4.91-4.18 4.2-11.68 4.2H13.36c-9.43 0-14.66-1.64-13.08 5.14 15.51 1.29 33.22.47 49.53.47-2.91 5.49-2.1 4.2-10.28 4.2-6.27 0-12.15-1.59-12.15 3.27 0 2.82 5.2 1.87 7.94 1.87H45.6c-.4 1.74-2.14 5.61.94 5.61h121.48v6.07c3.21-.07 36.53-18.97 42.52-21.95 2.58-1.29 12.35-6.16 13.55-7.95-1.46-5.46-15.15-9.83-19.63-9.35l-5.59.59-11.5-38.82c4.09.01 6.13 1.67 9.62.86.9-1.88 1.37-8.04 1.72-10.43.35-2.44 2.46-9.17-.32-9.66-1.56-.27-18.88 2.77-21.03 3.26l-.58 2.79c-3.12.02-9.88-1.32-13.45-1.84-4.06-.59-3.49-2.8-5.4-10.48-2.71-10.82-2.71-18.5-14.21-18.5-10.58 0-15.85 12.2-21.35 22.11-3.82 6.88-11.36 22.59-11.36 32.56z"></path><path class="fil0-delivery" d="M43.27 69.15c0 4.28 5.7 2.8 11.68 2.8l-.82 4.24c-4.01-.03-7.91-.03-11.8-.03-4.33 0-8.88-1.07-8.88 3.27 0 3.08 8.57 1.87 11.68 1.87 5.4 0 10.24-1.56 7.48 4.2-.59.59-22.75 0-26.17 0-6.53 0-5.69 2.76-5.14 5.14 5.16 1.21 67.4.47 78.03.47 6.26 0 6.2-5.31 7.08-10.68l5.07-30.44c.85-5.11 3.66-11.68-3.27-11.68H65.69c-4.88 0-5.35 2.93-6.12 6.97l-2.95 17.13c-.38 2.65.23 3.97-2.15 4.39-3.54.63-11.2-1.6-11.2 2.35zm164 64.48c.64 2.42 5.13 5.61 5.13 10.28 0 7.15-7.13 14.02-14.48 14.02-5.91 0-12.05-7.41-8.88-14.02-2.09.17-9.96 4.92-12.14 6.07.16 7.18 2.77 9.44 5.8 13.82 2.2 3.2 8.84 5.34 14.29 5.34 16.52 0 31.59-18.75 25.04-34.86-.45-1.13-3.31-5.79-4.02-5.79-1.72 0-8.94 4.19-10.74 5.14zM139.98 17.29c0 5.75-.44 6.62 4.2 8.88l19.63 9.81c2.18 0 5.64-2.39 6.54-3.74-1.81-2.48-11.83-6.99-11.21-10.75l1.41-9.34 16.27 5.36C176.68 7.56 168.6 0 157.27 0c-8.89 0-17.29 8.29-17.29 17.29zM52.61 149.52c0 12.15 7.85 19.62 20.09 19.62 11.65 0 24.85-11.32 25.7-21.49-2.96 0-8.72-.82-10.75.46-1.76.72-.26-.23-1.3 1.51-1.53 2.58-1.29 2.48-3.94 4.93-6.61 6.13-18.59 3.74-18.59-6.9H52.61v1.87z"></path></g></g></svg>
  {%- endif -%}

  {%- if block.settings.logo_estimativa_de_entrega == 'correios' -%}
    <svg xmlns="http://www.w3.org/2000/svg" width="65" height="65" viewBox="0 0 65 65" style="height: 46px;width: 46px;"><defs><linearGradient id="acorreio" gradientUnits="userSpaceOnUse" x1="68.842" y1="28.894" x2="10.054" y2="74.824" gradientTransform="translate(16.94 14.805) scale(.24915)"><stop offset="0" style="stop-color:#fd0;stop-opacity:1"></stop><stop offset=".9" style="stop-color:#d49f00;stop-opacity:1"></stop><stop offset="1" style="stop-color:#fd0;stop-opacity:1"></stop></linearGradient><linearGradient id="bcorreio" gradientUnits="userSpaceOnUse" x1="70.016" y1="75.86" x2="27.218" y2="75.86" gradientTransform="translate(16.94 14.805) scale(.24915)"><stop offset="0" style="stop-color:#d49f00;stop-opacity:1"></stop><stop offset="1" style="stop-color:#ab5808;stop-opacity:1"></stop></linearGradient><linearGradient id="ccorreio" gradientUnits="userSpaceOnUse" x1="55.928" y1="62.218" x2="114.819" y2="16.372" gradientTransform="translate(16.94 14.805) scale(.24915)"><stop offset="0" style="stop-color:#00537e;stop-opacity:1"></stop><stop offset=".9" style="stop-color:#18aae2;stop-opacity:1"></stop><stop offset="1" style="stop-color:#107bc0;stop-opacity:1"></stop></linearGradient><linearGradient id="dcorreio" gradientUnits="userSpaceOnUse" x1="91.804" y1="-4.211" x2="66.794" y2="15.329" gradientTransform="translate(16.94 14.805) scale(.24915)"><stop offset="0" style="stop-color:#002542;stop-opacity:1"></stop><stop offset="1" style="stop-color:#004169;stop-opacity:1"></stop></linearGradient></defs><path style="stroke:none;fill-rule:evenodd;fill:url(#acorreio)" d="M24.84 37.527h-.996c-.801 0-1.52-.375-1.996-.972l-4.735-6.078a.951.951 0 0 1-.172-.524c0-.2.075-.375.172-.523l4.762-6.078a2.499 2.499 0 0 1 1.992-.973h10.516l-5.98 7.5-4.36 5.504Zm0 0"></path><path style="stroke:none;fill-rule:evenodd;fill:url(#bcorreio)" d="m28.477 29.953-.051-.074-4.383 5.504c-.176.226-.324.523-.324 1.023 0 .5.472 1.121 1.418 1.121h9.246Zm0 0"></path><path style="stroke:none;fill-rule:evenodd;fill:url(#ccorreio)" d="m40.934 16.95-.797-2.145h.996c.797 0 1.52.375 1.992.972l4.762 6.078a.951.951 0 0 1 .172.524c0 .2-.075.375-.172.523l-4.785 6.078a2.504 2.504 0 0 1-1.993.973H30.594l5.98-7.5Zm0 0"></path><path style="stroke:none;fill-rule:evenodd;fill:url(#dcorreio)" d="m36.523 22.379.051.074 4.36-5.504c.175-.226.324-.523.324-1.023 0-.496-.473-1.121-1.422-1.121h-9.242Zm0 0"></path><path style="stroke:none;fill-rule:nonzero;fill:#0bbbef;fill-opacity:1" d="M41.184 16.848c.171-.223.273-.473.273-.774 0-.695-.574-1.27-1.27-1.27h-.324c.696 0 1.246.575 1.246 1.27 0 .301-.101.574-.277.774l-4.309 5.53-5.906 7.552Zm0 0"></path><path style="stroke:none;fill-rule:nonzero;fill:#ffd500;fill-opacity:1" d="M23.816 35.484a1.228 1.228 0 0 0-.273.774c0 .695.574 1.27 1.27 1.27h.324c-.696 0-1.27-.575-1.27-1.27 0-.301.098-.574.274-.774l4.336-5.53 5.906-7.552Zm0 0"></path><path style="stroke:none;fill-rule:nonzero;fill:#06416a;fill-opacity:1" d="M31.258 42.113a3.39 3.39 0 0 0-1.047.153c-.535.168-.934.449-1.234.847-.516.668-.5 1.469-.5 1.469v5.563h1.484a.166.166 0 0 0 .164-.168v-5.278c0-.101.02-.469.219-.652.164-.149.383-.215.597-.25.235-.031.47-.016.586 0h.032a.29.29 0 0 0 .25-.149l.765-1.316a3.404 3.404 0 0 0-1.316-.219m-4.363 0c-.399 0-.735.051-1.051.153-.532.168-.934.449-1.23.847-.52.668-.5 1.469-.5 1.469v5.563h1.48a.167.167 0 0 0 .168-.168v-5.278c0-.101.015-.469.215-.652.168-.149.382-.215.601-.25.235-.031.465-.016.582 0h.035c.098 0 .2-.067.25-.149l.782-1.332c-.434-.132-.848-.218-1.332-.203m-12.961 5.985a.314.314 0 0 0-.25-.118c-.051 0-.118.016-.149.047-.5.301-1.101.485-1.734.485a3.388 3.388 0 0 1-3.383-3.399 3.384 3.384 0 0 1 3.383-3.383c.633 0 1.234.168 1.734.485.047.035.098.05.164.05.102 0 .184-.05.25-.117l.852-1.097a5.01 5.01 0 0 0-3-.985 5.061 5.061 0 0 0-5.063 5.063 5.062 5.062 0 0 0 8.063 4.082Zm22.507-4.5a2.5 2.5 0 0 1 2.364 1.699H34.09a2.5 2.5 0 0 1 2.351-1.7m0-1.597a4.087 4.087 0 0 0-4.082 4.078c0 2.234 1.832 4.067 4.082 4.082h.114c.883 0 1.601-.113 2.55-.73l.149-.102s-.832-1.082-.848-1.098a.326.326 0 0 0-.234-.117c-.05 0-.098.016-.149.032-.218.117-.867.402-1.582.402-1.086 0-2-.684-2.351-1.652h6.25a.165.165 0 0 0 .164-.165l.016-.468v-.184C40.54 43.832 38.707 42 36.44 42Zm5.211 8.18c-.097 0-.164-.067-.164-.168v-7.578c0-.086.067-.168.164-.168h1.317c.101 0 .168.082.168.168v7.578a.167.167 0 0 1-.168.168ZM19.18 43.566a2.46 2.46 0 0 0-2.465 2.465 2.462 2.462 0 0 0 2.465 2.465 2.463 2.463 0 0 0 2.468-2.465 2.46 2.46 0 0 0-2.468-2.465m0 6.614a4.131 4.131 0 0 1-4.13-4.133 4.131 4.131 0 1 1 8.262 0 4.142 4.142 0 0 1-4.132 4.133Zm28.886-6.547a2.452 2.452 0 0 0-2.449 2.445 2.44 2.44 0 0 0 2.45 2.434 2.447 2.447 0 0 0 2.449-2.434 2.45 2.45 0 0 0-2.45-2.445m0 6.527a4.094 4.094 0 0 1-4.097-4.097 4.094 4.094 0 0 1 4.097-4.098 4.094 4.094 0 0 1 4.098 4.097 4.094 4.094 0 0 1-4.098 4.098Zm8.747-4.715c-.282-.133-.649-.215-1.047-.316-.586-.149-1.133-.184-1.336-.5a.6.6 0 0 1 .168-.813c.582-.402 1.367-.234 1.8-.035.082.035.399.215.399.215.05.035.101.05.148.05.102 0 .184-.05.25-.132l.836-1.066-.133-.118c-.086-.066-.203-.132-.316-.199-.25-.133-1-.566-2.086-.566h-.098c-2.382.05-2.714 1.734-2.714 2.332 0 .898.464 1.55 1.164 1.95.566.316 1.617.5 2.148.667a.895.895 0 0 1 .566.465.644.644 0 0 1 .051.266c.016.316-.148.667-.617.816-.516.152-1.316.086-2.047-.48a.74.74 0 0 0-.133-.102c-.035-.016-.066-.016-.117-.016-.101 0-.183.051-.25.133-.015.016-.816 1.05-.816 1.05s.281.231.383.298c.464.351 1.3.816 2.382.816h.032c2.3 0 2.832-1.633 2.832-2.531 0-.899-.547-1.781-1.45-2.184"></path></svg>
  {%- endif -%}

  {%- if block.settings.logo_estimativa_de_entrega == 'personalizado' -%}
    <img decoding="async" style="width: 36px; height: auto;"
      loading="lazy"
      src="{{ block.settings.img_logo_pesonalizado_estimativa_de_entrega | img_url: '100x' }}"
      width="{{ block.settings.img_logo_pesonalizado_estimativa_de_entrega.width }}"
      height="{{ block.settings.img_logo_pesonalizado_estimativa_de_entrega.height }}"
      class="shipping-country-flag fadeIn lazyloaded" alt="frete-brazil">
  {%- endif -%}

  <div class="frete-geoip-text">
  <p class="shipping-preview-loading">Carregando aguarde...</p>
  <p class="custom-address"></p>
  <p class="shipping-estimated"></p>
  </div>
</div>

{%- if block.settings.exibir_selo_de_garantia_estimativa_de_entrega or block.settings.exibir_selo_de_devolucao_estimativa_de_entrega or block.settings.exibir_selo_reclame_aqui_estimativa_de_entrega -%}
<div class="selos-frete-modelo-1">
  {%- if block.settings.exibir_selo_de_garantia_estimativa_de_entrega -%}
    <div id="badges-product">
      <div class="badge-block">
        <i style="vertical-align: middle;padding-right:10px; margin-top: 1px;">
          <svg width="1em" height="1em" viewBox="0 0 16 16" class="bi bi-check-circle" fill="currentColor" xmlns="http://www.w3.org/2000/svg"><path fill-rule="evenodd" d="M8 15A7 7 0 1 0 8 1a7 7 0 0 0 0 14zm0 1A8 8 0 1 0 8 0a8 8 0 0 0 0 16z"/><path fill-rule="evenodd" d="M10.97 4.97a.75.75 0 0 1 1.071 1.05l-3.992 4.99a.75.75 0 0 1-1.08.02L4.324 8.384a.75.75 0 1 1 1.06-1.06l2.094 2.093 3.473-4.425a.236.236 0 0 1 .02-.022z"/></svg>
        </i>
        <div class="badge-text">
          <p class="text-badge">{{ block.settings.texto_selo_de_garantia }}</p>
        </div>
      </div>
    </div>
  {%- endif -%}

  {%- if block.settings.exibir_selo_de_devolucao_estimativa_de_entrega -%}
    <div id="badges-product">
      <div class="badge-block">
        <i style="vertical-align: middle;padding-right:10px; margin-top: 1px;">
          <svg width="1em" height="1em" viewBox="0 0 16 16" class="bi bi-bootstrap-reboot" fill="currentColor" xmlns="http://www.w3.org/2000/svg"><path fill-rule="evenodd" d="M1.161 8a6.84 6.84 0 1 0 6.842-6.84.58.58 0 0 1 0-1.16 8 8 0 1 1-6.556 3.412l-.663-.577a.58.58 0 0 1 .227-.997l2.52-.69a.58.58 0 0 1 .728.633l-.332 2.592a.58.58 0 0 1-.956.364l-.643-.56A6.812 6.812 0 0 0 1.16 8zm5.48-.079V5.277h1.57c.881 0 1.416.499 1.416 1.32 0 .84-.504 1.324-1.386 1.324h-1.6zm0 3.75V8.843h1.57l1.498 2.828h1.314L9.377 8.665c.897-.3 1.427-1.106 1.427-2.1 0-1.37-.943-2.246-2.456-2.246H5.5v7.352h1.141z"></path></svg>
        </i>
        <div class="badge-text">
          <p class="text-badge">{{ block.settings.texto_selo_de_devolucao }}</p>
        </div>
      </div>
    </div>
  {%- endif -%}

  {%- if block.settings.exibir_selo_reclame_aqui_estimativa_de_entrega -%}
    <div id="badges-product">
      <div class="badge-block">
        <svg class="badge-icon" xmlns="http://www.w3.org/2000/svg" width="16" height="17" viewBox="0 0 12 14"><path fill-rule="nonzero" d="M5.305 10.354l-1.686 3.34-1.24-2.458H0l1.64-3.202a5.2 5.2 0 1 1 8.588.194l1.54 3.008H9.39l-1.241 2.458-1.673-3.315a5.266 5.266 0 0 1-1.171-.025zm-1.001-.237a5.201 5.201 0 0 1-1.975-1.234l-.693 1.353h1.357l.626 1.239.685-1.358zm3.192.064l.653 1.294.625-1.239h1.358l-.617-1.204a5.193 5.193 0 0 1-2.019 1.15zM6 9.2a4 4 0 1 0 0-8 4 4 0 0 0 0 8z"></path></svg>
        <div class="badge-text">
          <p class="text-badge">{{ block.settings.texto_selo_reclame_aqui }}</p>
        </div>
      </div>
    </div>
  {%- endif -%}
</div>
{%- endif -%}
</div>

<script>
  function convertDate(date) {
    const day = date.getDate();
    return `${day < 10 ? "0" + day : day}`;
  }

  function getMesExtenso(monthIndex) {
    const meses = [
      "janeiro",
      "fevereiro",
      "março",
      "abril",
      "maio",
      "junho",
      "julho",
      "agosto",
      "setembro",
      "outubro",
      "novembro",
      "dezembro"
    ];

    return meses[monthIndex];
  }

  document.addEventListener("DOMContentLoaded", function () {
    const currentDate = new Date();
    const prazoFinal = {{ block.settings.prazo_final_estimativa_de_entrega }};
    const prazoInicial = {{ block.settings.prazo_inicial_estimativa_de_entrega }};

    const startDate = new Date(currentDate);
    startDate.setDate(currentDate.getDate() + prazoInicial);

    const endDate = new Date(currentDate);
    endDate.setDate(currentDate.getDate() + prazoFinal);

    const startMonth = getMesExtenso(startDate.getMonth());
    const endMonth = getMesExtenso(endDate.getMonth());

    let dateRange;
    if (startDate < endDate) {
      dateRange = `<strong>${convertDate(startDate)} de ${startMonth}</strong> até <strong>${convertDate(endDate)} de ${endMonth}</strong>`;
    } else {
      dateRange = `<strong>${convertDate(endDate)} de ${endMonth}</strong> até <strong>${convertDate(startDate)} de ${startMonth}</strong>`;
    }

    {% if block.settings.api_estimativa_de_entrega == 'api_1' %}
      fetch("https://ipv4.wtfismyip.com/json")
        .then(response => response.json())
        .then(data => {
          const location = data.YourFuckingLocation.replace(", Brazil", "");
    {% else %}
      fetch("https://ipapi.co/json/")
        .then(response => response.json())
        .then(data => {
          const location = `${data.city}, ${data.region_code}`;
    {% endif %}

          {% if block.settings.habilitar_api %}
            document.querySelector(".custom-address").innerHTML = `<span style="color: {{ block.settings.cor_titulo_estimativa_de_entrega }};">{{ block.settings.texto_frete_estimativa_de_entrega }}</span> para <strong><span style="color: {{ block.settings.cor_titulo_estimativa_de_entrega }};">${location} e Região</span></strong>`;
          {% else %}
            document.querySelector(".custom-address").innerHTML = `<span style="color: {{ block.settings.cor_titulo_estimativa_de_entrega }};">{{ block.settings.texto_frete_estimativa_de_entrega }}</span>`;
          {% endif %}

          {%- if block.settings.tipo_de_prazo_estimativa_de_entrega == 'automatico' -%}
            document.querySelector(".shipping-estimated").innerHTML = `{{ block.settings.texto_estimativa_de_entrega }} ${dateRange}.`;
          {%- endif -%}

          {%- if block.settings.tipo_de_prazo_estimativa_de_entrega == 'manual' -%}
            document.querySelector(".shipping-estimated").innerHTML = `{{ block.settings.texto_prazo_manual_estimativa_de_entrega }}`;
          {%- endif -%}

          document.querySelector(".shipping-preview-loading").style.display = "none";
        });
  });
</script>
				
			

2 - Colar código json no template principal

				
					    {
      "type": "frete_geoip",
      "name": "Frete geoip",
      "limit": 1,
      "settings": [
        {
          "type": "checkbox",
          "id": "habilitar_api",
          "label": "Habilitar API",
          "default": true
        },  
        {
          "type": "select",
          "id": "api_estimativa_de_entrega",
          "label": "API",
          "options": [
            {
              "value": "api_1",
              "label": "API (wtfismyip.com)"
            },
            {
              "value": "api_2",
              "label": "API (ipapi.co)"
            }
          ],
          "default": "api_2"
        },
        {
          "type": "color",
          "id": "cor_titulo_estimativa_de_entrega",
          "label": "Cor do título",
          "default": "#47B192"
        },
       {
          "type": "color",
          "id": "cor_do_titulo_selos",
          "label": "Cor do título selos",
          "default": "#47B192"
        },        
        {
          "type": "color",
          "id": "cor_do_texto",
          "label": "Cor do texto",
          "default": "#4a4a4a"
        },
        {
          "type": "color",
          "id": "cor_do_icone",
          "label": "Cor do ícone",
          "default": "#333333"
        },        
        {
          "type": "select",
          "id": "tipo_de_prazo_estimativa_de_entrega",
          "label": "Tipo de prazo",
          "options": [
            {
              "value": "automatico",
              "label": "Automático"
            },
            {
              "value": "manual",
              "label": "Manual"
            }
          ],
          "default": "automatico"
        },
        {
          "type": "range",
          "id": "prazo_inicial_estimativa_de_entrega",
          "label": "Prazo inicial",
          "min": 1,
          "max": 30,
          "step": 1,
          "info": "Coloque o prazo minimo de entrega",
          "default": 10
        },
        {
          "type": "range",
          "id": "prazo_final_estimativa_de_entrega",
          "label": "Prazo final",
          "min": 1,
          "max": 50,
          "step": 1,
          "info": "Coloque o prazo máximo de entrega",
          "default": 20
        },
        {
          "type": "textarea",
          "id": "texto_frete_estimativa_de_entrega",
          "label": "Título do frete",
          "default": "<b>Frete Grátis</b>"
        },
        {
          "type": "textarea",
          "id": "texto_estimativa_de_entrega",
          "label": "Texto estimativa de entrega",
          "default": "Entrega prevista"
        },
        {
          "type": "textarea",
          "id": "texto_prazo_manual_estimativa_de_entrega",
          "label": "Texto prazo manual",
          "default": "Entregamos em até <strong>50 minutos</strong>"
        },
        {
          "type": "select",
          "id": "logo_estimativa_de_entrega",
          "label": "Logo",
          "options": [
            {
              "value": "aviao",
              "label": "Avião"
            },
            {
              "value": "moto",
              "label": "Moto"
            },
            {
              "value": "correios",
              "label": "Correios"
            },
            {
              "value": "personalizado",
              "label": "Personalizado"
            }
          ],
          "default": "correios"
        },
        {
          "type": "image_picker",
          "id": "img_logo_pesonalizado_estimativa_de_entrega",
          "label": "Logo personalizado",
          "info": "Coloque aqui uma imagem no formato png (tamanho indicado 64x64)"
        },
        {
          "type": "checkbox",
          "id": "exibir_selo_de_garantia_estimativa_de_entrega",
          "label": "Exibir selo de garantia",
          "default": false
        },
        {
          "type": "html",
          "id": "texto_selo_de_garantia",
          "label": "Texto selo de garantia",
          "default": "<span>Garantia.</span> 30 dias direto em nossa loja."
        },
        {
          "type": "checkbox",
          "id": "exibir_selo_de_devolucao_estimativa_de_entrega",
          "label": "Exibir selo de devolução",
          "default": false
        },
        {
          "type": "html",
          "id": "texto_selo_de_devolucao",
          "label": "Texto selo de devolução",
          "default": "<span>Devolução.</span> 7 dias para trocas e devoluções."
        },
        {
          "type": "checkbox",
          "id": "exibir_selo_reclame_aqui_estimativa_de_entrega",
          "label": "Exibir selo reclame aqui",
          "default": false
        },
        {
          "type": "html",
          "id": "texto_selo_reclame_aqui",
          "label": "Texto selo reclame aqui",
          "default": "<span>RA 1000.</span> Loja bem avaliada no Reclame Aqui."
        },
        {
          "type": "range",
          "id": "margin_top_estimativa_de_entrega",
          "label": "Espaçamento superior",
          "min": -30,
          "max": 30,
          "step": 1,
          "default": 25
        },
        {
          "type": "range",
          "id": "margin_bottom_estimativa_de_entrega",
          "label": "Espaçamento inferior",
          "min": -30,
          "max": 30,
          "step": 1,
          "default": 10
        },
        {
          "type": "range",
          "id": "margin_bottom_selos_estimativa_de_entrega",
          "label": "Espaçamento inferior (selos)",
          "min": -30,
          "max": 30,
          "step": 1,
          "default": 25
        }
      ]
    },
				
			

3 - Adicione o código para renderizar snippet

				
					              {%- when 'frete_geoip' -%}
                {%- render 'frete-geoip', product: product, block: block -%}
				
			

4 - Adicione este bloco ao seu tema e personalize-o conforme desejar.