ideal-postcodes / magento

UK Address Finder & Postcode Lookup Magento Extension
https://ideal-postcodes.co.uk/magento
2 stars 2 forks source link

Avoid loading binding.min.js in places other than Checkout #394

Open cblanc opened 2 years ago

cblanc commented 2 years ago

Potential starting points:

cblanc commented 2 years ago

Seems like we won't be able to do this since some customers are relying on the bindings being loaded outside of checkout (to allow address validation elsewhere)

timpea commented 2 years ago

@cblanc can it not be an option in the admin to enable site wide? Or just on standard Magento customer address pages?

cblanc commented 2 years ago

Hey @timpea was about to drop you an email

I'll reopen ask @mfilip about this as a possibility

In the meantime if you're able to load JS on the checkout, you can also disable the plugin and drop in the following scripts:

https://github.com/ideal-postcodes/magento/blob/master/view/base/web/binding.min.js

<script src="above binding.min.js"></script>
<script>
document.addEventListener('DOMContentLoaded', function() {
  window.idpcConfig = {
    apiKey: "your key",
    postcodeLookup: true,
    autocomplete: true,
    populateCounty: true,
    populateOrganisation: true,
    hoistCountry: true,
  };
  window.idpcStart();
});
</script>