About tokengating
Tokengating lets merchants offer eligible token holders exclusive access to products and discounts. For example, a merchant can give customers who hold their token a 25%-off discount. Customers can unlock the discount by connecting their wallet to prove that they own the token. Merchants can use tokengating to build loyalty and reward mechanisms for their communities and customers.
Anchor to Tokengating app requirementsTokengating app requirements
Tokengating apps on Shopify enable merchants to gate access to products, promotions, and content based on the contents of a customer’s Web3 wallet. All gated variants and all gated line items within completed orders must have a programmatic representation of their gated status using metafields.
All tokengating apps must have a programmatic representation of their gated status using metafields with the following specifications:
Anchor to Tokengating order metafieldsTokengating order metafields
Any orders that contain line items that are either added or discounted as a result of a buyer successfully passing a gate-check must be identified by adding the line item IDs to the Order
object through the use of the following specified metafields:
Tokengating order metafields GraphQL mutation
mutation($input: OrderInput!) {
orderUpdate(input: $input) {
order {
metafields(first: 100) {
edges {
node {
namespace
key
value
}
}
}
}
}
}
{
"input" : {
"id": "gid://shopify/Order/{$order_id}",
"metafields": [
{
"namespace": "web_3",
"key": "gated_wallet_line_items",
"value":
[
"{$line_item_id}",
"{$line_item_id}"
],
"type": "list.single_line_text_field"
}
]
}
}
Anchor to Tokengating product metafieldsTokengating product metafields
Any products that contain one or more gated variants must list the gated variant IDs within the Product
object using product metafields as follows:
Tokengating product metafields GraphQL mutation
mutation($input: ProductInput!) {
productUpdate(input: $input) {
product {
metafields(first: 100) {
edges {
node {
namespace
key
value
}
}
}
}
}
}
{
"input" : {
"id": "gid://shopify/Product/{$product_id}",
"metafields": [
{
"namespace": "web_3",
"key": "gated_variants",
"value":
[
"{$product_variant_id}",
"{$product_variant_id}"
],
"type": "list.single_line_text_field",
}
]
}
}