How to get all Shop Shipping methods Ids or Shipping zones in checkout page with liquid

2k views Asked by At

I am trying to get all the store shipping methods Ids in Select shipping method page by modifying checkout.liquid

Or at least get the shipping_zones json in the same page.

I am talking about the IDs in /admin/api/2019-04/shipping_zones.json and I am using Shopify Plus.

I tried this script in the checkout.liquid layout but it returned an empty output I think this because the fact that a shipping method is still not added to the checkout object

  <script>
    <!-- DEBUG {{ checkout.shipping_method.title }} has been used -->
    {% if checkout.shipping_method.title == 'Pick-up at the store' %}
      Shopify.Checkout.OrderStatus.addContentBox(
        `<p>Okay</p>`
      )
    {% endif %}
  </script>

I also tried this but didn't work either:

Shipping methods: <br>
{% for shipping_method in checkout.shipping_methods %}
* {{ shipping_method.title }}: {{ shipping_method.price | money }} <br>
{% endfor %}

Please help I really need this.

1

There are 1 answers

4
David Lazar On

You are Plus, so you get access to Shipping information using the Script Editor App. With that, you can setup your checkout to be as useful as possible. See the methods here: https://help.shopify.com/en/manual/apps/apps-by-shopify/script-editor/shopify-scripts#shipping-methods

It is really quite simple to hot-rod shipping using scripting. The best and usually only part of Plus I believe provides supreme value.

As a second solution if you cannot figure out how to manipulate Shipping from that Scripting, then use an App and that way you can control Shipping methods yourself. The Pro is you can do what you want, the con is you're responsible for your server being 24/7 ready to go, which is a hassle for a lot of merchants. If your shipping machine goes down, your checkouts go down too, which is why you want to maximize using Scripts in Plus