๐Picket BigCommerce App - Merchant Documentation
Token gated commerce with a few simple clicks from your BigCommerce dashboard
Last updated
Token gated commerce with a few simple clicks from your BigCommerce dashboard
Last updated
Token gated products and discounts are common use cases of the Picket API. The Picket app on BigCommerce allows you to set up token gated discounts and token gated products from BigCommerce admin without the need for custom code.
Token Gated Discounts:
Enabling token gated discounts allows you to set discounts that can only be applied by users who hold the NFT or other token that you specify. You can do this on a product by product basis. You also can choose to require NFTs or tokens on any of the chains that Picket supports.
Token Gated Exclusive Products
Enabling token gated exclusive products allows you to set products as exclusives that can only be purchased by users who hold the NFT or other token that you specify. You can do this on a product by product basis. You also can choose to require NFTs or tokens on any of the chains that Picket supports.
You can install Picket from the BigCommerce App Store
Before you begin, make sure that you have the Picket app for BigCommerce installed on your store and open in the BigCommerce control panel.
Add your Picket API Key to the BigCommerce Picket App
Your Picket API key is located in your Picket dashboard and is listed under publishable key.
Copy your publishable key and paste it in the corresponding field in BigCommerce Picket App.
2. Select the tokens you would like to use for your token gate
For Ethereum and other EVM chains, this is done by putting the contract address of the tokens you'd like to use for your token gate into the contract address field.
If you don't know the contract address of the tokens you'd like to use for your token gate, you can find it for Ethereum and othfer EVM based chains by searching for your desired NFTs or other tokens here.
3. Select how many tokens you want to require users to have
For NFT token gates this is most commonly set to 1. However, this is up to you.
4. Set the discount rate you'd like to give to users who have the token you require
5. Select any products that you'd like the discount to apply to for users who hold your chosen token.
Follow the same steps above for setting token gated discounts. However, instead of selecting products at the end as discount products within the "Token Gate Configuration by Product Section" within the BigCommerce control panel. Select products as exclusives with the checkboxes shown below:
This guide is based off v6.7.0 of the BigCommerce Cornerstone theme. The installation process involves the same steps for every theme, but the location of the them files and html you need to modify will differ.
Once you've configured your token gated exclusive and discounted products, you need to make it visible within your BigCommerce Storefront theme. Like many other BigCommerce apps, this requires modifying the theme files, adding additional html handlebar templates, and adding data-picket
attributes to existing elements.
We'll walk you through each step in the process below, but if you get stuck or run into issue, don't hesitate to reach out to team@picketapi.com.
Checkout BigCommerce's documentation if you run into issues
To get started, we need to modify your BigCommerce's storefront theme files.
From your BigCommerce control panel, go to Storefront > Themes. If you have multiple stores, your storefront theme will be under the Channel Manager.
Click Edit Theme.
If you are using the default BigCommerce theme, you'll have to Copy your theme before you will be able to edit it.
Once you've opened up the theme editor (Page Builder), click Theme Styles > Edit Theme Files
Once you've opened up the Storefront theme file editor, you'll see several directories
For this guide, we are going to modify the following files
/templates/components/products/add-to-cart.html
/templates/components/products/price.html
/templates/components/products/price-range.html
/templates/components/products/card.html
/templates/components/products/product-view.html
/templates/components/products/custom-fields.html
/templates/pages/cart.html
This guide uses Cornerstone v6.7.0. The names of files and where you add additional token gating markup will differ between themes, but the concept and components will remain the same.
Here are references to the components will copy-paste into the files listed above
Now we can start modifying the theme's existing files to enable token gating.
The first step in enabling token gating is to allow users to verify token ownership. To do this, we want to place an a Verify Token Ownership button near any "Add to Cart" buttons.
Place this snippet on product pages above payment buttons like "Add to Cart", "Buy Now", etc.
In the Cornerstone v6.7.0, we want to add this code to the templates/components/products/add-to-cart.html file right above to the add to cart buttons near line 43
Now users are able to verify token ownership! If you are looking at a token exclusive or discounted product, you should see a button like this
Next, we need to prevent users who don't hold the required tokens from adding token holder exclusive products to their cart.
To prevent users from purchasing exclusive products, we remove the payment buttons until the user has verified that they hold the necessary tokens. We do this by conditionally adding style="display: none;"
and data-picket="payment-buttons-container"
if the product is a token holder exclusive.
In the v6.7.0 Cornerstone theme, this snippet should be place in templates/components/products/add-to-cart.html near the bottom of file on the <div class="add-to-cart-buttons">
on line 45
Depending on your storefront theme, you may have to add this logic to multiple places. In the v6.7.0 Cornerstone theme, you only need to add it to one more place. There is also an add to cart button that shows on hover on the product browsing page. Let's hide that for products that are token holder exclusives
In the v6.7.0 Cornerstone theme, this snippet should be place in templates/components/products/card.html in the {{#if add_to_cart_url }}
section between lines 103-106
For token holder exclusive products, the payment buttons should be hidden, so you only see the verify token ownership button, like this
We now have token gated products! Next let's improve the user experience by showing which products are token gated and/or eligible for token holder discounts.
We want to indicate to users which products are exclusive to token holders. Similar to how we indicate which items are on sale, we are going to show a badge next to the price of products that are exclusive to token holders.
Add the following components to wherever your theme displays badges next to the product title. For the v6.7.0 Cornerstone theme, there are two locations we want to display token exclusive badges: the product card previews and the product page. First we'll add it to the product card previews
In the v6.7.0 Cornerstone theme, this snippet should be place in templates/components/products/card.html above the {{#if brand.name}}
section between lines 122-123
Next, we'll add the same badge with slightly different styling to the product page
In the v6.7.0 Cornerstone theme, this snippet should be place in templates/components/products/product-view.html below the product brand {{#if brand.name}}
section between lines 102-103
Once inserted, you'll see a badge next to the price of token holder exclusive products, like this
Next, we'll show the discounted price for products that are discounted for token holders.
There are a few steps to showing the discounted product price for token holders. First, we are going to find the <div>
s that contain the price displayed in our shop. Second, we will display the discounted price for token holders. And finally, we'll mark the regular price with a data attribute, so we can cross it out for users who hold the necessary tokens.
Find the container around the price displayed in your shop. In all relevant containers, add data-picket="price-container"
to the container element
In the v6.7.0 Cornerstone theme, this snippet should be place in templates/components/products/price.html to replace the <div class="price-section price-section--withoutTax">
section on line 72
Within the price container, we are going to display the discounted price that token holders pay
In the v6.7.0 Cornerstone theme, this snippet should be place in templates/components/products/price.html after line 85
Once this snippet is inserted, we should see the discounted price displayed below or next to the original price
Lastly, we are going to mark the regular price with a data-picket="price-regular-amount"
. This allows us to strikethrough the regular price once a user has verified token ownership.
In the v6.7.0 Cornerstone theme, this element is in templates/components/products/price.html on line 82
Amazing! Once a user verifies token ownership, they will automatically have the discount code applied at checkout to the relevant products and will see the new prices like this
Finally, we want to show users that have successfully verified ownership that they will have a discount applied at checkout to any eligible products.
To add the cart message, find the code that displays the checkout button on the cart page
In the v6.7.0 Cornerstone theme, this snippet should be placed in templates/pages/cart.html after {{{region name="cart_below_totals"}}}
on line 30
And that's it! For users that have verified token ownership, they'll see a message like this
And that's it! You are all done. You have enabled token gated products with an awesome user experience all controllable from an admin panel.
Need help setting up your token gated products and discounts? If you have any trouble with these instructions or just have a few questions, we're here to help. Email us at team@picketapi.com or find some time for a zoom call with a member of our engineering team for more hands on realtime help.