Created
April 12, 2012 20:37
-
-
Save travishaynes/2370815 to your computer and use it in GitHub Desktop.
Using EasyXDM in Shopify to access the cart
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
window.Shopify = new EasyXDM.Rpc({ | |
remote: "http://domain.myshopify.com/cart" | |
}, { | |
remote: { | |
getCart: {} | |
} | |
}); |
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
new easyXDM.Rpc({}, { | |
local: { | |
getCart: function(callback) { | |
return $.getJSON("/cart.js", function(cart) { | |
return callback(cart); | |
}); | |
} | |
} | |
}); |
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
Shopify.getCart(function(cart){ | |
console.log(cart); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment