Internationalisation from one code base

Hi all –

I have a question that I’d be SUPER grateful for some input on as I just can’t crack it.

In short, I have an online store that uses the could-hosted SAAS platform ‘Shopify’ – it is based in Australia,
with a .com.au domain but I also want to target new zealand customers ( I purchased the equivalent .co.nz
domain name). Every tutorial I have ready outlines how to use hrefland and canonical links to direct to the
correct site, but assumes a separate actual site; on Shopify this would require me to create a whole
second shop and go down the route of syncing orders/customers/products – basically it’d be a real nightmare.

So my solution was to use some javascript to determine which domain they’d used to arrive at the site
and therefore assume if they were from Aus or NZ, and change this if they asked to change currency.
I can then use these conditionals to serve the correct hreflang/canonical tag and even the correct content
(I’d only change this occassionally, such as prices, delivery info etc).

This would allow me to avoid showing nz customers a .com.au domain name which I think would
be a turn off.

I’d really like some feedback if this would be an okay seo practice? I’ve certainly done similar things before
in terms of language, it’s just how google would find it that I’m not 100% on.

Thanks so much!