Articles on: Advanced Setup

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
Setup instructions
Examples

Overview



You can conditionally prevent Downpay from initializing on the product page based on custom conditions. To do this, set the following variable in javascript inside your theme:

window.downpay.disabledOnFirstLoad


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 choose Custom Liquid
- Use the examples below or your own workflow to hide Downpay based on specific rules



Examples



Show Downpay to logged in customers with a specific customer tag



{% unless customer.tags contains "vip" %}
    <script>
        window.downpay = window.downpay || {};
        window.downpay.disabledOnFirstLoad = true;
    </script>
{%  endunless  %}


Show Downpay only when a product is sold out



This will only work with a product that only has one purchase option in Downpay (non variant purchase options).

{% if product.selected_or_first_available_variant.inventory_quantity >= 1 %}
<script>
window.downpay = window.downpay || {};
window.downpay.disabledOnFirstLoad = true;
</script>
{% endif %}


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: 06/06/2024

Was this article helpful?

Share your feedback

Cancel

Thank you!