Forked from sarachisholm/four-smart-reasons-to-embed-shopify-store-html-container-element.js
Last active
March 17, 2017 19:10
-
-
Save shopifypartners/23907bb7bb8279489c6371aec9c6071a to your computer and use it in GitHub Desktop.
HTML container element for Buy Button - https://www.shopify.com/partners/blog/four-smart-reasons-to-embed-a-shopify-store-in-your-client-websites
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
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); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment