How-to
How to embed Google Wallet or Apple Wallet button on WordPress
A wallet button in WordPress is either a link to one public pass, or a plugin that issues a pass per order, booking, or ticket. The snippet on this page is only the public link. It does not know who checked out.
The shared snippet is also documented in add a wallet button on a website.
Static link or a pass per person
| You are issuing | Put this on the page |
|---|---|
| One coupon or membership anyone may add | A Button block or the Custom HTML snippet, both pointing at that pass link |
| One Apple Wallet pass per WooCommerce order | AddToWallet Order Pass, on the order, not this snippet |
| One ticket per WooCommerce attendee | AddToWallet Event Pass |
| One pass per appointment | Amelia, Bookly, LatePoint, or Simply Schedule Appointments |
| One pass per event ticket | Sugar Calendar, EventON, or Modern Events Calendar |
Button block or Custom HTML
Prefer the core Button block when the only job is to open the pass link. It is a normal link, so keyboard users reach it the same way as any other button, and you do not need permission to post raw HTML.
Use Custom HTML when you want the Apple or Google badge image from the snippet. On many hosts only an administrator can save unfiltered HTML. An editor role may see the block stripped on update. Paste it as a user who is allowed to keep script and markup, then view the page logged out.
- Edit the page or post.
- Add a block. For a text link, choose Buttons and set the URL to the pass link. For the badge, choose Custom HTML.
- If you use Custom HTML, paste the snippet and replace buttonUrl with the pass link. The dotted placeholder is not a pass.
- Update or publish. Open the page in a private window.


<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 people see
The snippet shows the Apple Wallet badge in Safari and the Google Wallet badge in Chrome. Other browsers get the Google Wallet badge. Activate the control with Enter or Space the same way as a button. If a security plugin removes the script, use the Button block instead of fighting the filter.


Logged-out and both phones
- Logged-out view shows the button. A preview while you are an admin is not enough.
- iPhone Safari can add the pass.
- Android Chrome can save the pass.
- A WooCommerce thank-you page is still the order or event plugin's job, not this HTML block, unless you deliberately want one shared pass for every buyer.