How-to
How to embed Google Wallet or Apple Wallet button on Shopify
This page adds one wallet button to a Shopify Online Store page. The button opens a pass link you already created. It does not issue a pass per order.
That is a different product from AddToWallet Order Pass, which puts an order-tracking block on the Thank you page and the Order status page. Installing Order Pass does not place this storefront button, and this Custom Liquid block does not track an order.
Storefront button or order block
| You want | Where it goes | What to install |
|---|---|---|
| One public pass on a page, such as a coupon anyone may add | Online Store theme, Custom Liquid, on a page template | The snippet below. No Shopify app is required for that button. |
| A pass for each paid order, updated when you fulfill or cancel | Checkout editor: Thank you, and Order status | The AddToWallet Order Pass app, then the Order Wallet Pass block. Not this snippet. |
The general button pattern for other sites is add a wallet button on a website.
Custom Liquid on an Online Store 2.0 theme
Use a theme that has sections in the theme editor. Vintage themes without Custom Liquid need a different edit, and this guide does not cover that file.
- Shopify admin, Online Store, Themes. Work on the theme you will publish, or copy your notes onto that theme before you finish. An unpublished draft can look done and never reach the storefront.
- Customize.
- Open the page template, Add section, Custom Liquid.
- Paste the snippet. Replace the buttonUrl value with the pass link you copied from AddToWallet. The placeholder in the snippet is not a live pass.
- Save, then open the published page in a private browser, not only the editor preview.



<script>
window.onload = function() {
// Paste the pass link here in the button url string
const buttonUrl="https://app.addtowallet.co/card/........";
var button = document.getElementById("addToWalletButton");
var userAgent = window.navigator.userAgent;
var img = document.getElementById("walletImage");
if (userAgent.indexOf("Chrome") != -1 && userAgent.indexOf("Safari") != -1 && userAgent.indexOf("Edg") == -1) {
img.src = "https://s3.amazonaws.com/i.addtowallet.co/assets/Add_to_Google_Wallet_badge.svg.png";
} else if (userAgent.indexOf("Safari") != -1 && userAgent.indexOf("Chrome") == -1) {
img.src = "https://s3.amazonaws.com/i.addtowallet.co/assets/add_to_apple_wallet.png";
} else {
img.src = "https://s3.amazonaws.com/i.addtowallet.co/assets/Add_to_Google_Wallet_badge.svg.png";
}
button.style.background = 'none';
button.style.border='none';
button.style.width = '250px';
button.style.height = '72px';
img.style.width = '100%';
img.style.height = '100%';
button.style.cursor = 'pointer';
button.onmousedown = function() {
button.style.transform = 'scale(0.9)';
}
button.onmouseup = function() {
button.style.transform = 'scale(1)';
}
button.onclick = function() {
window.open(buttonUrl, '_blank');
}
}
</script>
<button id="addToWalletButton">
<img id="walletImage" src="" alt="addToWalletButton"/>
</button>


What the button shows
The snippet picks a badge from the browser. Safari on an iPhone is the Apple Wallet badge. Chrome is the Google Wallet badge. Other browsers get the Google Wallet badge. The click opens buttonUrl.


Check both phones
- Published theme, logged-out visit, button visible.
- iPhone Safari opens the pass link and can add it to Apple Wallet.
- Android Chrome opens the pass link and can save it to Google Wallet.
- Thank you and Order status are unchanged unless you also installed Order Pass on purpose.