<script>
const checkoutButtons = document.querySelectorAll('[name="checkout"]');
checkoutButtons.forEach((button) => {
button.disabled = true;
});
</script>
<div
id="cart"
style="display:flex; justify-content:flex-end;"
{% if customer %}
{% if customer.id %}
data-customer-id="{{ customer.id }}"
{% endif %}
{% if customer.email %}
data-customer-email="{{ customer.email }}"
{% endif %}
{% if customer %}
{% if customer.default_address %}
{% if customer.default_address.zip %}
data-customer-address-zip-1="{{ customer.default_address.zip }}"
{% endif %}
{% if customer.default_address.country_code %}
data-customer-address-country-code-1="{{ customer.default_address.country_code }}"
{% endif %}
{% endif %}
{% endif %}
{% endif %}
></div>
{% schema %}
{
"name": "Options Block",
"target": "section",
"javascript": "cart.js",
"settings": []
}
{% endschema %}
I’m facing an issue with this Liquid code. Sometimes, even when a customer is logged in, I don’t get the customer’s address. This doesn’t happen every time, but when it does, even if I log out and log in again, it doesn’t get fixed. The only solution is to clear the cookies and log in again. I have seen that if the _shopify_essential
cookie is not present, I don’t get the customer’s address.