How do you build an app that launches a modal after someone adds to cart?

Highlighted
New Member
2 0 1

 

I'm looking to build an app that pops up a modal dialog and can interact with the user's cart, similar to this:

http://recordit.co/VaeAF5CBTT

I'm familiar with the backend and GraphQL shopify APIs, but haven't found how I would do something like this yet. Can someone point me in the right direction? Bonus points for links to tutorials.

Thanks!

 

1 Like
Highlighted
New Member
5 0 0

Hi,

I am new to Shopify and I want to create something very similar, did you came up with a solution?

0 Likes
Highlighted
New Member
2 0 1

Yep - use a script tag to add a Javascript file that you create and host somewhere.

https://shopify.dev/docs/admin-api/rest/reference/online-store/scripttag

Then add a click event something like this:

 

 

$(".product-form button[type=submit]").each(function(){
  $(this).click(function(event) {
    event.preventDefault();
    $('#myModal').modal('show');
  });
});



 

0 Likes
Highlighted
New Member
5 0 0

Thanks for the reply and nice workaround!

0 Likes