Skip to content

Instantly share code, notes, and snippets.

Shopify Partners shopifypartners

Block or report user

Report or block shopifypartners

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View sublime-plugins-emmet-shorthand-expanded.html
<div id="page">
<div class="logo"></div>
<ul id="navigation">
<li><a href="">Item 1</a></li>
<li><a href="">Item 2</a></li>
<li><a href="">Item 3</a></li>
<li><a href="">Item 4</a></li>
<li><a href="">Item 5</a></li>
</ul>
</div>
View four-smart-reasons-to-embed-shopify-store-html-container-element.js
client.fetchProduct('your-product-id').then(function(product) {
var html =
"<img class='product__image' src='" + product.selectedVariantImage.src + "' >" +
"<h2 class='product__title'>" + product.title + "</h2>" +
"<a class='product__buy' href='" +
product.selectedVariant.checkoutUrl(1) +
"'>Buy Now!</a>";
$('#product-1').html(html);
View four-smart-reasons-to-embed-shopify-store-updates.js
var variantSelectors = generateSelectors(product);
$('.variant-selectors').html(variantSelectors);
function generateSelectors(product) {
var elements = product.options.map(function(option) {
return '<select name="' + option.name + '">' + option.values.map(function(value) {
return '<option value="' + value + '">' + value + '</option>';
}) + '</select>';
});
View four-smart-reasons-to-embed-shopify-store-AddVarianttoCart.js
var $cartLineItems = checkout.lineItems.map(function (lineItem, index) {
var $lineItemTemplate = $(lineItemEmptyTemplate);
var itemImage = lineItemImages[lineItem.variant_id];
$lineItemTemplate.find('.cart-item__img').css('background-image', 'url(' + itemImage + ')');
$lineItemTemplate.find('.cart-item__title').text(lineItem.title);
$lineItemTemplate.find('.cart-item__variant-title').text(lineItem.variant_title);
$lineItemTemplate.find('.cart-item__price').text(formatAsMoney(lineItem.line_price));
$lineItemTemplate.find('.cart-item__quantity').attr('value', lineItem.quantity);
$lineItemTemplate.find('.quantity-decrement').attr('data-variant-id', lineItem.variant_id);
$lineItemTemplate.find('.quantity-increment').attr('data-variant-id', lineItem.variant_id);
View sticky-add-to-cart.html
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.1.1/jquery.min.js"></script>
<script src="jquery.sticky.js"></script>
<script>
$(document).ready(function(){
$(".add-to-cart").sticky({topSpacing:50});
});
</script>
You can’t perform that action at this time.