Change Free Shipping Progress Bar for International Customers

Hello,

I currently can only offer free shipping to domestic (USA) customers and my theme offers a free shipping progress bar in the cart drawer.

I tested with a VPN and it currently does not check for country. So if someone wanted to order from France, they would still see the progress bar and be mislead to believe they will qualify for free shipping.

There is a free-shipping-bar.liquid file with this code in it:

{%- comment -%}
----------------------------------------------------------------------------------------------------------------------
FREE SHIPPING BAR
----------------------------------------------------------------------------------------------------------------------

Renders the free shipping bar component. It is used on cart page and cart drawer to render the remaining amount before
being eligible for free shipping.

********************************************
Supported variables
********************************************

* size: accept the value "sm"
{%- endcomment -%}

{%- liquid
  assign calculated_total_price = 0

  for line_item in cart.items
    if line_item.requires_shipping
      assign calculated_total_price = calculated_total_price | plus: line_item.final_line_price
    endif
  endfor
-%}

<free-shipping-bar class="free-shipping-bar" threshold="{{ settings.cart_free_shipping_threshold | times: 100.0 }}" total-price="{{ calculated_total_price }}" reached-message="{{ 'cart.free_shipping_bar.limit_reached_html' | t | escape }}" unreached-message="{{ 'cart.free_shipping_bar.limit_unreached_html' | t | escape }}">
  {%- comment -%}The span below is the placeholder where the content will be inserted in JS{%- endcomment -%}
  <span> </span>

  <progress-bar class="progress-bar" role="progressbar" aria-valuemin="0" style="--progress: 0"></progress-bar>
</free-shipping-bar>

I’d like for the bar to only appear to those within the USA. Would anyone happen to know how I could do that?

URL: www.journey-java.com

Thank you!

Bumping this up. Anyone have any insights?

Hi,

I had the same type of problem and had to create a different rule for certain countries.

This code displays your Free Shipping bar if your shop has the iso code “US” for other shops it won’t display anything.

I hope this helps.

Here’s what you could try:

{%- comment -%}
----------------------------------------------------------------------------------------------------------------------
FREE SHIPPING BAR
----------------------------------------------------------------------------------------------------------------------

Renders the free shipping bar component. It is used on cart page and cart drawer to render the remaining amount before
being eligible for free shipping.

********************************************
Supported variables
********************************************

* size: accept the value "sm"
{%- endcomment -%}

{%- liquid
  assign calculated_total_price = 0

  for line_item in cart.items
    if line_item.requires_shipping
      assign calculated_total_price = calculated_total_price | plus: line_item.final_line_price
    endif
  endfor
-%}
{% if request.locale.iso_code == 'us' %}

{% else %}
{%- endif -%}