Show/Hide Downpay Conditionally
Learn how to show or hide Downpay deposits on the product page for specific regions or customers
On this page:
Overview
You can conditionally prevent Downpay from initializing on the product page (on page load only) based on custom conditions.
Setup instructions
2.0 Themes Setup
2.0 Themes include a liquid block that may be used for this functionality.
- Navigate to the Shopify theme editor and to the product page template
- Click
Add block
and chooseCustom Liquid
- Use the examples below or your own workflow to hide Downpay based on specific rules
Examples
Show Downpay up until the due date
This workflow is useful when you are holding workshops or have travel bookings where you do not want to display the deposit option on or after the due date set in Downpay.
{% assign future_date_string = product.selected_or_first_available_selling_plan_allocation.selling_plan.options[0].value %}
{% comment %}
Convert the ISO8601 string "YYYY-MM-DDTHH:MM:SS.sssZ" to a Unix timestamp and cast to integer
{% endcomment %}
{% assign future_date_ts = future_date_string | date: "%s" | plus: 0 %}
{% comment %}
Get current timestamp and cast to integer
{% endcomment %}
{% assign now_ts = "now" | date: "%s" | plus: 0 %}
{% if now_ts >= future_date_ts %}
<script>
window.downpay = window.downpay || {};
window.downpay.disabledOnFirstLoad = true;
</script>
{% endif %}
Show Downpay up until 1 week from the due date
This workflow is useful when you are holding workshops or have travel bookings where you do not want to display the deposit option one week prior to the event.
{% assign future_date_string = product.selected_or_first_available_selling_plan_allocation.selling_plan.options[0].value %}
{% comment %}
Convert the ISO8601 string "YYYY-MM-DDTHH:MM:SS.sssZ" to a Unix timestamp and cast to integer
{% endcomment %}
{% assign future_date_ts = future_date_string | date: "%s" | plus: 0 %}
{% comment %}
Get current timestamp and cast to integer
{% endcomment %}
{% assign now_ts = "now" | date: "%s" | plus: 0 %}
{% comment %}
Calculate the timestamp for one week before the due date (7 days * 86400 seconds per day) and cast to integer
{% endcomment %}
{% assign one_week_before_ts = future_date_ts | minus: 604800 | plus: 0 %}
{% if now_ts >= one_week_before_ts %}
<script>
window.downpay = window.downpay || {};
window.downpay.disabledOnFirstLoad = true;
</script>
{% endif %}
Show Downpay to logged in customers with a specific customer tag
This workflow is useful for various use cases:
- Enable Downpay only for your internal sales team to use to create orders for phone orders. This workflow is often used to circumvent Shopify's draft orders not supporting partial payment
- Enable only certain customers to leave a deposit
- Assign a customer tag to the specific customers that should be able to see Downpay
- Follow the theme setup above to add a liquid block to your product template
- Copy the code below into the liquid block and adjust the tag to fit your setup.
{% unless customer.tags contains "vip" %}
<script>
window.downpay = window.downpay || {};
window.downpay.disabledOnFirstLoad = true;
</script>
{% endunless %}
- Click
Save
Show Downpay only when a product is sold out
{% if product.selected_or_first_available_variant.inventory_quantity >= 1 %}
<script>
window.downpay = window.downpay || {};
window.downpay.disabledOnFirstLoad = true;
</script>
{% endif %}
Don't show Downpay on certain product with a specific tag
This script will hide Downpay on products that are tagged with a specific tag. This is useful when you want to hide Downpay on specific add on product pages. Use this code and adjust to suit the tag you use on your store.
{% unless product.tags contains "addon" %}
<script>
window.downpay = window.downpay || {};
window.downpay.disabledOnFirstLoad = true;
</script>
{% endunless %}
Show Downpay to a specific market
For example, if you would like to show Downpay deposit options to only customers shopping from the French Market, you would add the following code to your theme.liquid
file or your main product liquid template.
{% if localization.market.handle == 'fr' %}
<script>
window.downpay = window.downpay || {};
window.downpay.disabledOnFirstLoad = true;
</script>
{% endif %}
Updated on: 21/03/2025
Thank you!