Open Embeded Cart without Clicking The Cart Icon

New Member
7 0 0

We are trying to figure out if there's a way to open the embeded cart on our external site.

Once you add something to the cart, it shows up with an icon and how many things are in the cart.

We want to be able to click the View Cart link at the top of the page in our navigation to open the embeded cart along with the clicking the icon on the side of the page. 

See the picture below.

Thanks!

0 Likes
Shopify Staff
Shopify Staff
144 0 18

Hi Roger, 

Thanks for your post!

This one's a bit tricky so I had a colleague help me out. A suggestion that was brought up was that your best bet would be to redirect to a product page by changing 

data-redirect_to="cart"

to

data-redirect_to="product"`

That may be a posssible workaround. You'll likely need to confirm and discuss with Expert. 

Here's a link on editing buttons or carts though for your reference: https://docs.shopify.com/manual/more/buy-button/edit-delete

I hope this helps!

Cheers,

John
Support@Shopify.com

 

0 Likes
Shopify Expert
9981 85 1492

That's good advice from John above.

If you're feeling a little experimental however: When the embed button is added to the page there's a series of other scripts added in as well. Now I would expect this to possibly change in the future but as of right now you can open the cart by firing this JavaScript function.

ShopifyEmbed.root.showCartContent()

For safety you'd at least want to make sure that the Shopfy embed code is even on the page to start with. A verbose safety check could look like so:

if(typeof ShopifyEmbed === 'object'){
  if(typeof ShopifyEmbed.root === 'object'){
    if(typeof ShopifyEmbed.root.showCartContent === 'function'){
      ShopifyEmbed.root.showCartContent();
    }
  }
}

 

★ Winning Partner of the Build a Business competition. ★ http://freakdesign.com.au
1 Like
New Member
7 0 0

Thank you both for your responses. Jason's reply is just what I was looking for. I put the code in a fuction below where the code for the embeded cart is. Worked like a charm. Thank you both.

While I've got your attention though, is there a way enlarge the text in the embeded cart that says "Shipping and discount codes are added at checkout." at the bottom?

And this may not be possible, but is there a way to change the text at the bottom of the checkout from Terms of Service to something else. Just wondering.

Thanks!

0 Likes
Highlighted
New Member
2 0 0

@Jason  Dear Jason,

 

Please might you be able to tell me what code I would need now as I think as you alluded to, your excellent solution no longer works?

 

Thanks so much,

 

SJacket

0 Likes