foxy_io

Display message under rates for specific countries

Oct 7th, 2019
32
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. {% if context == "cart" or context == "checkout" %}
  2. <script>
  3. FC.client.on("render.done", function() {
  4.     var message = '<h4>Shipping too expensive?</h4><p>Cases are available in Europe from our distributor Density Labs! <a href="#" style="text-decoration:underline;">Click here for more details.</a></p>';
  5.     var countries = ['AT', 'BE', 'BG', 'HR', 'CY', 'CZ', 'DK', 'EE', 'FI', 'FR', 'DE', 'GR', 'HU', 'IE', 'IS', 'IT', 'LV', 'LT','LU', 'MT', 'NL', 'PL', 'PT', 'RO', 'SK', 'SI', 'ES', 'SE', 'CH', 'GB', 'IS', 'LI', 'NO'];
  6.  
  7.     if (countries.indexOf(FC.json.shipping_address.country) > -1) {
  8.         if ($(".shipping-note").length == 0 && FC.json.shipping_address.shipping_results.length > 0) {
  9.             if (FC.json.context == "checkout") {
  10.                 $(".fc-checkout__section--shipping-results").append('<div class="row shipping-note"><div class="col-sm-10 col-sm-push-1">' + message + '</div></div>');
  11.             } else {
  12.                 $(".fc-shipping-rates").append('<div class="fc-input-group--sidebar shipping-note"><br>' + message + '</div>');
  13.             }
  14.         }
  15.     } else {
  16.         $(".shipping-note").remove();
  17.     }
  18. });
  19. </script>
  20. {% endif %}
Advertisement
Add Comment
Please, Sign In to add comment