Shopify Plus - Show map before checkout (checkout.liquid)

Shopify Plus customers can add a javascript code to the checkout.liquid file to offer their customers the selection before payment.

Please note before installation: 

  • This solution will enable you to reach selection levels close to 100%, but which cannot be guaranteed. So you'll always have a few orders that fall through the cracks. Service Point
  • Relay Point feedback will stop working if you uninstall the app. Mondial Relay
  • If you want to hide the lockers in the list of Relay Points, set the hideLockers variable to true in the code below.
  • DO NOT FORGET TO REPLACE THE VARIABLE YOUR_LABEL_CODE WITH YOUR LABEL CODE MONDIAL RELAY in the code below

Important information:

  • If you use a third-party application to generate your delivery methods (Advanced Shipping Rules, Parcelify...), the selection card may not be displayed when you click on "Choose my Service Point". In this case, please contact our support team at support@mondial-relay-app.com

Voici le code à ajouter dans la balise <head> du fichier checkout.liquid : 

DON'T FORGET TO REPLACE THE VARIABLE YOUR_BRAND_CODE WITH YOUR BRAND CODE. MONDIAL RELAY

<script>
  if (window.location.href.indexOf("checkout") > -1){
    var enseigneClient = 'VOTRE_CODE_ENSEIGNE';
    var customRule = '';
    window.MR_config = {
      hideLockers: false 
    }
    var MondialRelayScript = document.createElement('script');
    MondialRelayScript.type = 'text/javascript';
    MondialRelayScript.src = 'https://shopify-mondial-relay.s3.eu-west-3.amazonaws.com/MR-select-pickup-shopify-plus.js';
    MondialRelayScript.setAttribute('enseigne', enseigneClient);
    MondialRelayScript.setAttribute('customRule', customRule);
    document.getElementsByTagName('head')[0].appendChild(MondialRelayScript);
    var count = 0;
    var waitFunction = function() {
      if (document.querySelectorAll('.section--shipping-method input').length > 0) {
        var selectedInput = document.querySelector('input[checked=\'checked\']');
        if (selectedInput && decodeURIComponent(selectedInput.getAttribute('value')).toLowerCase().indexOf('mondial-relay') > 1 && document.querySelectorAll('.section-shipping-method input')[1]) {
          document.querySelectorAll('.section--shipping-method input')[1].click();
        } else {
          count += 1;
          if (count < 40) {
            setTimeout(function(){
              waitFunction();
            }, 500);
          }
        }
      }
    };
    waitFunction();
  }
</script>

Have you found your answer? Thank you for your feedback Oops! Computer error... Your note has not been taken into account

Didn't find an answer? Contact us Contact us