Sometimes customers will request to see if the NFT they are thinking of buying has already claimed a discount or a product in a given campaign. We have the ability to check to see if a NFTs discount or product has already been claimed.

To add a redemption checker for a limited discount campaign

percs_engage_nft_check_redemption_001.gif

Setup

Modify your product page snippet to include the PERCS Check Token Redemption form. This snippet ensures other functionality still works.

Note: Depending on your template you can find the product page in the Sections folder of the Theme it might be called main-product.liquid.

percs_engage_add_theme_snippet.gif

<!-- PERC: Snippet - START -->
{% liquid
  assign perc = false
  assign hideCart = false
  assign percCheckout = false
  assign showNftDiscountCodeCheck = false

  for tag in product.tags
    if tag contains 'perc:'
      assign perc = true
      
      if tag contains 'perc:access'
        assign hideCart = true
      endif
      
      if tag contains 'perc: checkout'
        assign percCheckout = true
        assign showNftDiscountCodeCheck = true
      endif
      
      if tag contains 'perc: discount'
        assign showNftDiscountCodeCheck = true
      endif
    
    endif
  endfor
%}
{% if perc %}
{% if hideCart %}
<style>
  .product-form__buttons {
    display: none;
  }
</style>
{% endif %}
<div>
  {% if percCheckout %}
  {% else %}
  	<nft-connect customer="{{customer.id}}" customer-token="{%for m in customer.metafields.global%}{%if m[0]=="token"%}{{m[1]}}{%endif%}{%endfor%}" product="{{product.id}}" variant="{{product.variants[0].id}}" />
  {% endif %}
  <script type="text/javascript" src="{{ 'nft-connect.js' | asset_url }}"></script>
</div>
{% endif %}
<!-- PERC: Snippet - END -->

Place this on bottom of main-product.liquid.

<!-- We recommend placing this form under the product form -->
<!-- PERC: Check Token Redemption {{showNftDiscountCodeCheck}} - Snippet - START -->
{% if showNftDiscountCodeCheck %}
  <nft-redemption-check product="{{ product.id }}" ></nft-redemption-check>
{% endif %}
<!-- PERC: Check Token Redemption {{showNftDiscountCodeCheck}} - Snippet - END -->

Example of what the Dawn Theme main-product.liquid file looks like after we add in the snippets above: https://bitbucket.org/blockx20/workspace/snippets/rX5jpE

We recommend placing the form at the bottom of the product page

We include checks to see if the current product has a discount or product redemption campaign running on it. Then render the Check Token Redemption form accordingly.

To add a redemption checker for a limited redemption campaign

Ensure that this code block is at the top of your main-page.liquid page


<script type="text/javascript" src="{{ 'nft-connect.js' | asset_url }}"></script>