Shopify Plus - Show map before checkout (checkout.liquid)
Shopify Plus customers can add a javascript code to the checkout.liquid file to offer pre-payment selection to their customers.
Please note before installation:
- This solution will allow you to reach selection levels close to 100% but which cannot be guaranteed. So you will always have some orders that will fall without Service Point
- The Relay Points feedback will stop working if you uninstall the app Mondial Relay
Important:
- If you are using a third party application to generate your shipping methods (Advanced Shipping Rules, Parcelify...), it may happen that the selection card is not displayed when you click on "Choose my Service Point". In this case, please contact our support on mondialrelay.shopify@gmail.com
Voici le code à ajouter dans la balise <head> du fichier checkout.liquid :
ATTENTION, DO NOT FORGET TO REPLACE THE VARIABLE YOUR_NAME_CODE BY YOUR NAME CODE MONDIAL RELAY
<script> if (window.location.href.indexOf("checkout") > -1){ var enseigneClient = 'VOTRE_CODE_ENSEIGNE'; var customRule = ''; 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>