Global Snippets

Global snippets are reusable pieces of code that power your website. While using these snippets is not strictly required, we highly recommend you use the snippets we provide to assure your cart is compatible with future upgrades.

Snippets are included with the following syntax:

{% include snippet.name %}

snippet.payment_methods

This snippet is used on the cart to generate the payment methods available to your customers. It automatically updates when you add or remove payment methods.

{% include snippet.payment_methods %}

snippet.download_html

This snippet is used on the delivery page to generate the download button.

{% for file in item.files %}
  {% include snippet.download_html %}
{% endfor %}

If the download is active it generates HTML like:

<a href="..." class="button file-download">Download</a>

If inactive:

<a href="#" class="button red expired file-download">Download Expired</a>

Tip

If you want to change the download text, set the download_text and download_expired_text variables. The defaults are “Download” and “Download Expired”, respectively.

{% set download_text = "Download Here" %}
{% set download_expired_text = "Sorry, Download Expired" %}

Important

your for loop must use file as the local variable (as in the example).

snippet.keycode_html

This snippet generates the keycode html. If the keycode is a URL it generates a link. If the keycode is to be delivered as a file it generates a download button. If the keycode is a plain key it is displayed on the screen.

{% for key in item.keycodes %}
  <h3>Your Key:</h3>
  {% include snippet.keycode_html %}
{% endfor %}

If the keycode is a file or URL:

<a href="..." class="button keycode">Download</a>

Otherwise:

<p class="keycode">...</p>

Tip

If you want to change the download text, set the download_text variable. The default is “Download”.

{% set download_text = "Download Key" %}

Important

your for loop must use key as the local variable (as in the example).

snippet.checkout_html

This snippet generates the checkout HTML. DPD continuously improves the checkout process to improve conversions. This snippet is required on the checkout page template in order to complete checkout.

Important

This snippet is required on the checkout page. Your customers will not be able to complete their checkout if you remove this snippet from your cart.