Can you leverage theme-addresses outside of customers/addresses.js?

mkreyes
New Member
1 0 0

Hi everyone,

 

I'm new to the Shopify Community and wanted to reach out for some advice! I've built a custom form that collects address information for an optional personalized card. All the nitty gritty details aside, I want to leverage the `theme-addresses` package to localize a region and country drop down list in this custom form.

 

Resources:

https://help.shopify.com/en/themes/development/templates/customers-addresses

https://github.com/Shopify/theme-scripts/blob/master/packages/theme-addresses/README.md

 

I have several questions:

  1. Can this package be used outside of account pages and customers/addresses.liquid?
    • All the examples I've seen, have used theme-addresses in relation to customer addresses.
  2. If #1 is possible, what's the best way to implement theme-addresses?
    • Do I need to import shopify_common.js?
    • Are there other dependencies I need include?

 

Any help is greatly appreciated!

0 Likes

@mkreyes 

I am unsure how to make it would work exclusively for the theme-addresses but you can leverage the cache for the entire website via HTML.

I wrote an article about it (click here to read it), it takes less than 1 minute to do it - just copy/paste.

Let me know if it works for you.

Kind regards,
Diego

◦ Problem Solved? ✔️ Please click on Accept as Solution and like.
◦ Using a free theme? Improve it with copy/paste code snippets clicking here.
◦ Looking to hire an experienced developer? Same day response: ezfycode@gmail.com.
0 Likes