Automatically set currency based on customer country in registration (not geolocation)

Automatically set currency based on customer country in registration (not geolocation)

alexew
Visitor
2 0 0

Based on the answers to setting currency using geolocation, I have added 

<script>
if (customer.default_address.country_code === 'CA') {
$("#currencies").val("CAD");
$("#currencies").change();
}
else {
$("#currencies").val("USD");
$("#currencies").change();
}
</script>

Just before the end end tag for body in the theme.liquid file.  The site is set up to force a login, so the customer object exists before getting here.  However, the currency does not change as expected.   What am I missing?

Replies 0 (0)