Instantly share code, notes, and snippets.
shopifypartners
/ shopify-buy-button-and-wordpress-wp-enqueue-script.php
Last active
March 21, 2017 14:37
— forked from tessalt/enqueue_script.php
This file contains hidden or 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
| function theme_scripts() { | |
| wp_enqueue_script( 'buy-button', 'http://sdks.shopifycdn.com/buy-button/0.1.34/buybutton.min.js', array( ), '', true ); | |
| wp_enqueue_script( 'shopify-product', '/assets/js/custom.js', array('buy-button' ), '', true ); | |
| } | |
| add_action( 'wp_enqueue_scripts', 'theme_scripts' ); |
shopifypartners
/ shopify-buy-button-and-wordpress-initialize-the-client.js
Last active
March 21, 2017 14:46
— forked from tessalt/client.js
This file contains hidden or 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
| var client = ShopifyBuy.buildClient({ | |
| apiKey: 'your-api-key', | |
| domain: 'my-shop.myshopify.com', | |
| appId: '6' | |
| }); |
shopifypartners
/ shopify-buy-button-and-wordpress-initialize-the-ui-library.js
Last active
March 21, 2017 14:48
— forked from tessalt/ui.js
This file contains hidden or 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
| var ui = ShopifyBuy.UI.init(client); |
shopifypartners
/ shopify-buy-button-and-wordpress-fetch-product-information.js
Last active
March 21, 2017 14:50
— forked from tessalt/product.js
This file contains hidden or 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
| var productNodes = document.querySelectorAll('[data-shopify-product]'); | |
| Array.prototype.slice.call(productNodes).forEach(function (node) { | |
| var productId = node.dataset.shopifyProduct; | |
| ui.createComponent('product', { | |
| id: productId, | |
| node: node, | |
| }); | |
| }); |
shopifypartners
/ shopify-buy-button-and-wordpress-fetch-product-in-post.html
Last active
March 21, 2017 14:52
— forked from tessalt/post.html
This file contains hidden or 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
| <div data-shopify-product="1234567"></div> |
shopifypartners
/ shopify-buy-button-and-wordpress-iframeless-embeds.js
Last active
March 21, 2017 14:58
— forked from tessalt/iframeless.js
This file contains hidden or 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
| ui.createComponent('product', { | |
| id: productId, | |
| options: { | |
| product: { | |
| iframe: false | |
| }, | |
| cart: { | |
| iframe: false | |
| } | |
| } |
shopifypartners
/ shopify-buy-button-and-wordpress-css-styles.php
Last active
March 21, 2017 14:59
— forked from tessalt/styles.php
This file contains hidden or 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
| wp_enqueue_style( 'buy-button','http://sdks.shopifycdn.com/buy-button/0.1.34/buybutton.css' ); |
shopifypartners
/ shopify-buy-button-and-wordpress-shortcode.php
Last active
March 21, 2017 15:01
— forked from tessalt/shortcode.php
This file contains hidden or 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
| function shopify_shortcode ($atts) { | |
| $a = shortcode_atts(array( | |
| 'id' => '' | |
| ), $atts); | |
| return '<div data-shopify-product="' . $a['id'] . '"></div>'; | |
| } | |
| add_shortcode( 'shopify_product', 'shopify_shortcode' ); |
shopifypartners
/ shopify-buy-button-and-wordpress-wp-enqueue-script-js-buy-sdk.php
Last active
March 21, 2017 15:02
— forked from tessalt/enqueue_script.php
This file contains hidden or 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
| function enqueue_shopify_buy() { | |
| wp_enqueue_script('shopify-buy', 'http://sdks.shopifycdn.com/js-buy-sdk/v0/latest/shopify-buy.umd.polyfilled.min.js'); | |
| } | |
| add_action( 'admin_enqueue_scripts', 'enqueue_shopify_buy' ); |
shopifypartners
/ shopify-buy-button-and-wordpress-visual-product-picker.html
Last active
March 21, 2017 15:05
— forked from tessalt/picker.html
This file contains hidden or 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
| <ul id="products"></ul> | |
| <input id="product_id" name="product_id" type="text" /> |
OlderNewer