Last active
June 6, 2018 21:23
-
-
Save charlesemarsh/493fcecff56248c14db4a18beb76040f to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{% if template == 'cart' and cart.total_weight < 10000 %} | |
<script type="text/javascript"> | |
var CollectPlusData = { | |
shopify_domain: '{{ shop.permanent_domain }}', | |
settings: '{{ shop.metafields.collectplus.settings }}' | |
}; | |
var CollectPlusSettings = JSON.parse(CollectPlusData['settings']) | |
</script> | |
{% capture settings_data %}{{ shop.metafields.collectplus.settings }}{% endcapture %} | |
{% assign widget_split_1 = settings_data | split: 'widget' | last | replace: '"','' | replace: ':{','' %} | |
{% assign widget_json_data = widget_split_1 | split: "," %} | |
{% for widget_json in widget_json_data[0] %} | |
{% assign split_widget = widget_json | split: ':' %} | |
{% assign key = split_widget | first %} | |
{% assign value = split_widget | last %} | |
{% case key %} | |
{% when 'primary_colour' %} | |
{% assign primary_colour = value %} | |
{% when 'secondary_colour' %} | |
{% assign secondary_colour = value %} | |
{% when 'text_colour' %} | |
{% assign text_colour = value %} | |
{% when 'title' %} | |
{% assign title = value %} | |
{% endcase %} | |
{% endfor %} | |
{% assign google_split_1 = settings_data | split: 'google' | last | replace: '"','' | replace: ':{','' %} | |
{% assign google_split_2 = google_split_1 | split: "},widget" | first %} | |
{% assign google_json_data = google_split_2 | split: "," %} | |
{% for google_json in google_json_data[0] %} | |
{% assign split_google = google_json | split: ':' %} | |
{% assign key = split_google | first %} | |
{% assign value = split_google | last %} | |
{% case key %} | |
{% when 'api_key' %} | |
{% assign api_key = value %} | |
{% endcase %} | |
{% endfor %} | |
{% assign shipping_split_1 = settings_data | split: 'shipping' | last | replace: '"','' | replace: ':{','' %} | |
{% assign shipping_split_2 = shipping_split_1 | split: "},g" | first %} | |
{% assign shipping_json_data = shipping_split_2 | split: "," %} | |
{% for shipping_json in shipping_json_data %} | |
{% assign split_shipping = shipping_json | split: ':' %} | |
{% assign key = split_shipping | first %} | |
{% assign value = split_shipping | last %} | |
{% case key %} | |
{% when 'maximum_weight' %} | |
{% assign maximum_weight = value | times: 1000 %} | |
{% endcase %} | |
{% endfor %} | |
{% assign cart_settings_split_1 = settings_data | split: 'cart' | last | replace: '"','' | replace: ':{','', | replace: '}','' %} | |
{% assign cart_settings_split_2 = cart_settings_split_1 | split: "},g" | first %} | |
{% assign cart_settings_json_data = cart_settings_split_2 | split: "," %} | |
{% for cart_settings_json in cart_settings_json_data %} | |
{% assign split_cart_settings = cart_settings_json | split: ':' %} | |
{% assign key = split_cart_settings | first %} | |
{% assign value = split_cart_settings | last %} | |
{% case key %} | |
{% when 'minimum_order_value' %} | |
{% assign minimum_order_value = value | times: 100 %} | |
{% endcase %} | |
{% endfor %} | |
{% if maximum_weight > cart.total_weight %} | |
{% unless minimum_order_value > cart.total_price %} | |
<script src="https://maps.googleapis.com/maps/api/js?key={{ api_key }}"></script> | |
{{ '//cdn.rawgit.com/googlemaps/v3-utility-library/master/infobox/src/infobox_packed.js' | script_tag }} | |
{{ 'https://s3.eu-west-2.amazonaws.com/collectplus/collectplus-min.js' | script_tag }} | |
{{ 'collectplus.scss.css' | asset_url | stylesheet_tag }} | |
{% endunless %} | |
{% endif %} | |
{% endif %} | |
<style type="text/css"> | |
#collectplus-widget #collectplus-widget-inner #collectplus-header span { | |
border-bottom: 2px solid #ddd; | |
} | |
#collectplus-widget #collectplus-widget-inner #collectplus-tabs ul li a { | |
background: #ddd; | |
border: 1px solid #ddd; | |
border-radius: 3px; | |
} | |
#collectplus-widget #collectplus-widget-inner #collectplus-tabs li a.active-tab-header { | |
background: {{ primary_colour }}; | |
color: {{ text_colour }}; | |
border: 1px solid {{ primary_colour }}; | |
} | |
#collectplus-widget #collectplus-widget-inner #tab-content #collectplus-content h3 { | |
} | |
#collectplus-results>ul>li.selected-collectplus-store-li { | |
background: #f8f8f8; | |
color: #000; | |
} | |
#collectplus-widget #collectplus-widget-inner #tab-content #collectplus-content #content-inner #collectplus-results>ul>li .result-list-select-store-button a.infowindow-selected { | |
background-color: {{ primary_colour }}; | |
} | |
</style> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment