Skip to content

Instantly share code, notes, and snippets.

@seedcms
Last active January 4, 2018 16:40
Show Gist options
  • Save seedcms/4dac1e5168b5291fe381b9f71df86e5b to your computer and use it in GitHub Desktop.
Save seedcms/4dac1e5168b5291fe381b9f71df86e5b to your computer and use it in GitHub Desktop.
other-product-swatches-v-001.4
<div class="product-swatches-{{product.id}}"></div>
<div style="clear:both;"></div>
<script>
jQuery(document).ready(function(){
var appDomain = '//productswatches.herokuapp.com';
var url = appDomain + '/product_swatches/get-json/{{product.id}}';
var data = {
return_format: 'html',
product_id:'{{product.id}}',
tooltip: 'yes',
tooltip_split: '-',
tooltip_bg: '555',
tooltip_color: 'fff',
tooltip_font_size: '12px',
tooltip_font: 'sans-serif',
tooltip_padding: '5px',
tooltip_border_radius: '6px',
tooltip_css: '',
border_radius: '0%',
border_color: 'ffffff',
border_active: '000000',
border_width: '1',
width: '25',
height: '25',
swatch_title: '',
hide_sold_out: '',
{% if product.metafields.swatch.tag %}tag:'{{product.metafields.swatch.tag}}'{% endif %}
};
$.ajax({
type: 'post',
url: url,
data: data,
cache: false,
dataType: "html",
success: function(data) {
console.log(data);
$(".product-swatches-{{product.id}}").html(data);
}
});
}); // end on document ready
</script>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment