How-to
How to embed Google Wallet or Apple Wallet button on Weebly
On Weebly, a button or text link that opens the pass URL is the fallback when you do not want custom HTML. Use Embed Code when you want the badge snippet from this article. Site-wide button setup is in the embed guide.
The steps below follow the editor already shown here: Build, Basic, Embed Code, then Edit custom HTML. Publish the site and open the live page before you send people to it. This article does not publish a device result.
The snippet swaps the badge from the browser. Safari is set to the Apple Wallet badge. Chrome is set to the Google Wallet badge.


Use a plain link
- Create the pass and copy its link from the copy icon.
- Add a Weebly button or text link and set the URL to that pass link.
- Publish the site.

1. Open the Weebly editor
2. Find Embed Code under Basic on the Build tab
3. Drag Embed Code to the place the button should appear
4. Click Edit custom HTML


5. Paste the snippet and set the pass link
Paste the snippet into the block. Replace buttonUrl with the pass link. The address in the sample is a placeholder, not a live pass.
<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>
6. Click outside the block to preview

7. Publish and open the live page
Publish the site, open the live URL on a phone, and tap the link or button. Confirm the pass page opens. Write down the phone model and the browser. This article does not publish a device result.
Create Wallet Pass Now