-
Notifications
You must be signed in to change notification settings - Fork 115
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Opening the cart drawer with own button #367
Comments
You will have to setup your button to call |
And how exactly would I get a hold of the ui variable? |
It is the exact same ui variable that is referenced in all of the docs. http://shopify.github.io/buy-button-js |
I see. That is just not a variable that is accessible outside scope when having used the premade codesnippet from Shopify. function loadScript() {
var script = document.createElement('script');
script.async = true;
script.src = scriptURL;
(document.getElementsByTagName('head')[0] || document.getElementsByTagName('body')[0]).appendChild(script);
script.onload = ShopifyBuyInit;
}
function ShopifyBuyInit() {
var client = ShopifyBuy.buildClient({
domain: 'koishopper.myshopify.com',
apiKey: '2d5bb08eaabf97e3f1a05637cb2ac3c0',
appId: '6',
});
ShopifyBuy.UI.onReady(client).then(function (ui) {
ui.createComponent('collection', {
id: 409207441,
node: document.getElementById('collection-component-723f407073e'),
moneyFormat: '%7B%7Bamount%7D%7D%2C-',
options: { |
Yes that script snippet is supposed to be self contained to make sure anyone can copy and paste it and have it work. If you need something custom you will need to edit it. |
I too am looking for a <script> I can add to my pages that will allow me to trigger the Cart Drawer to open when a button is clicked. I had something similar with my HelpDesk widget. This does not currently work, but here is what I am attempting: -- Shopify Cart Open API -- -- Shopify Cart Open onclick() -- |
if anyone else is also looking for a solution add this code inside Works perfectly and my external button opens the cart drawer |
@cinghaman Hi, im wondering if i can integrate that on custom liquid, is that possible? do you have some steps how did you integrate that? Help me pleaseee. Thanks in advance |
Is it possible to create custom button on our site that can trigger the cart to open?
The text was updated successfully, but these errors were encountered: