To display currency notification in cart drawer

To display currency notification in cart drawer

In cart-drawer.liquid:
Idea
<div id="intl-cart-message" style="display: none; background:#730302; font-size: 12px; color: #ffffff; padding: 5px;">
 We process all orders in Malaysian Ringgit (MYR) and you will be checkout using the most current exchange rates.
</div>



In theme.liquid:
<script>
  document.addEventListener("DOMContentLoaded", function () {
      .then(res => res.json())
      .then(data => {
        if (data && data.country_code !== 'MY') {
          const showMessage = () => {
            const msg = document.getElementById('intl-cart-message');
            if (msg) msg.style.display = 'block';
          };

          // Try immediately
          showMessage();

          // Re-run on cart drawer update
          const observer = new MutationObserver(() => showMessage());
          const target = document.querySelector('body');
          if (target) {
            observer.observe(target, { childList: true, subtree: true });
          }
        }
      });
  });
</script>

    • Related Articles

    • Add custom text to the cart drawer

      1. Open cart-drawer.liquid file 2. Add html at the highlighted area >> <div class="message" style="background:#fff2d7;"> <p style="padding: 5px;">YOU ARE ELIGIBLE FOR THE DISCOUNT OF 50%</p> </div>
    • Removing country/selector from mobile drawer menu

      From your Shopify admin dashboard, click on "Online Store" and then "Themes". Find the theme that you want to edit and click on "Actions" and then "Edit code". In the "Assets" folder, click on "base.css, style.css or theme.css" file, depending on ...
    • Display bundle items in product page

      Add Metafields to Bundle Product Example metafield: Namespace & key: custom.bundle_items Type: List of Products (this is the ideal type for linking individual Shopify products) Assign Metafields to Bundle Product: Go to the bundle product in your ...
    • Display payment method icons at the footer

      From your Shopify admin, go to Online Store > Themes. Find the theme you want to edit, click the … button to open the actions menu, and then click Edit code. In the Sections directory, click footer.liquid. If your theme doesn't include this file, ...
    • Display color swatches on collection page filter

      Watch this video to see how to.