Snippet reference
Snippet reference
Section | Scenario Description | Examples | Default Value |
---|---|---|---|
Global | Enable/Disable Google Analytics Event Tracking - DEPRECATED
Some merchants may choose to disable anonymous tracking of customer behaviour when using the Shopify-Afterpay JS solution. | var clearpay_ga_enabled = false; | false |
Enable CBT Features
Not all merchants have Cross-Border Trade enabled at the account level. For those that do, this variable can be added/edited to reflect the configuration of the merchant account. If set to true, the JS will use the CBT editions of the modal images for the PDP and cart integrations. | var clearpay_cbt_enabled = true; | false | |
Show/Hide Currency Code
Clearpay displays the Shopify store's base currency next to the instalment amounts on product and cart pages. This can be disabled for merchants that meet the following criteria:
| var clearpay_show_currency_code = true; | Snippet version 1.0.2 and above, GBP currency:
Otherwise:
| |
Enable/Disable Responsive Modal
By default, the "more info" link next to the Clearpay logo launches a popup containing a static image. The image will be one of two options, depending on the screen width at the time of clicking the link. | var clearpay_modal_responsive = false; | Snippet version 1.0.2 and above:
Otherwise:
| |
Enable/Disable Icon
If enabled, an "ⓘ" icon is displayed next to the Clearpay logo in place of the "more info" text. Clicking the link launches the same info modal as normal. | var clearpay_modal_open_icon = true; | false | |
Hide Range Decimals
Since the Clearpay minimum and maximum values are predicable and usually rounded numbers, there is usually no need to show the two decimal places after the dollar amount. If desired, the decimal places can be removed with this override. Note: Although it's likely that this override will be used to remove the period and two zeros, the script does not examine the decimal places to verify that they are zeros before stripping them. | var clearpay_hide_range_decimals = false; | Snippet version 1.0.2 and above:
Snippet version 1.0.1 and below:
| |
Hide Range Upper Limit
Hide the upper limit from the outside limits messaging. For example: Clearpay available for orders over £1 Learn more | var clearpay_hide_upper_limit = true; | Snippet version 1.0.2 and above; using the Afterpay JS:
Otherwise:
| |
Hide Range Lower Limit
Hide the lower limit from the outside limits messaging. For example: Clearpay available for orders up to £1000 Learn more | var clearpay_hide_lower_limit = true; | false | |
Enable/Disable Footer Logo
Render a Clearpay logo in the footer next to the other payment methods. | var clearpay_footer_logo_enabled = false; | Snippet version 1.0.5 and above:
Otherwise:
| |
Customise Footer Logo Format
The following options are available:
| var clearpay_footer_logo_format = 'stacked'; | "icon" | |
Customise Footer Logo Theme
The following options are available:
| var clearpay_footer_logo_theme = 'black'; | "colour" | |
Customise Footer Logo Background
The following options are available:
| var clearpay_footer_logo_background = 'transparent'; | "border" | |
Change Footer Logo Selector
Clearpay normally determines the container selector automatically, through a series of search passes. If it cannot find a match, or the placement of the Clearpay elements needs to be changed, this override can be used. | var clearpay_footer_logo_container = '#footer-icons'; | undefined | |
Change Footer Logo Template
Clearpay normally determines the logo markup template automatically, through a series of search passes. If it cannot find a match, or the placement of the Clearpay elements needs to be changed, this override can be used. |
| undefined | |
Change Footer Logo CSS
Clearpay footer logo normally inherits styling of other payment icons by applying the their class names. In case the styling needs to be changed, this override can be used. | var clearpay_footer_logo_css = {width:'100px',height:'auto','margin-top':'-6px'}; | undefined | |
Product Page | Enable/Disable Clearpay Instalment Message
Most merchants want to see Clearpay calculations on their product pages. Some don't. This override controls whether or not the Clearpay elements will appear on the individual product pages. | var clearpay_product_integration_enabled = false; | true |
Logo Theme
This override allows the theme of only this specific placement of the Clearpay logo to be different from the theme globally defined in | var clearpay_product_logo_theme = 'white'; | undefined | |
Change Price Selector
Clearpay normally determines the product selector automatically, through a series of search passes. If it cannot find a match, or the placement of the Clearpay elements needs to be changed, this override can be used. If this is defined, the Clearpay paragraph will be injected after this element. It should be the closest block element that wraps the price. |
| undefined | |
Custom CSS
The CSS of the Clearpay paragraph (the |
| undefined | |
Different Price Selector for Desktop and Mobile
Sometimes, the theme uses different markup for desktop versus mobile, and the Clearpay elements may therefore not appear at the correct location in both views. If this is the case, use JavaScript to define a different value of the override depending on the screen size. Change the |
| undefined | |
Variable Price Fallback
In some cases, variant selection does not trigger a change event on the cart form. In other cases, an event does trigger, but Clearpay is unable to identify the price of the selected variant based on the data available. In any of these or similar cases, an override can be applied to extract the product price from a specified element on the page. It does this on DOM mutation events, or failing that, on a timed interval. Unlike the Price Selector, the Variable Price Fallback Selector should be the innermost element containing the actual currency-formatted price. |
| undefined | |
Variable Price Fallback Method
Can be "mutation" or "interval". The default is "mutation". In some cases, the watched element (or one of its ancestors) is completely destroyed and replaced when the price is updated. This renders the mutation observer ineffective. In these cases, the interval method can be used. Although it is inefficient and can be noticeably delayed, the interval method is dependable. | var clearpay_variable_price_fallback_method = "interval"; | "mutation" | |
Static Cart Page | Enable/Disable Clearpay Instalment Message
Some merchants want to see Clearpay calculations on their cart page. Others don't. This override controls whether or not the Clearpay elements will appear on the cart page. | var clearpay_cart_integration_enabled = false; |
|
Logo Theme
This override allows the theme of only this specific placement of the Clearpay logo to be different from the theme globally defined in | var clearpay_cart_static_logo_theme = 'white'; | undefined | |
Change Subtotal Selector
Clearpay normally determines the cart subtotal selector automatically, through a series of search passes. If it cannot find a match, or the placement of the Clearpay elements needs to be changed, this override can be used. If this is defined, the Clearpay paragraph will be injected after this element. It should be the closest block element that wraps the subtotal. |
| undefined | |
Custom CSS
The CSS of the Clearpay paragraph (the |
| undefined | |
Different Subtotal Selector for Desktop and Mobile
Just like on the product pages, sometimes the theme uses different markup for desktop versus mobile, and the Clearpay elements may therefore not appear at the correct location in both views of the cart page. If this is the case, use JavaScript to define a different value of the override depending on the screen size. Change the |
| undefined | |
Variable Subtotal Fallback
In some cases, the Clearpay instalment calculation does not update when the subtotal changes. An override can be applied to extract the subtotal from a specified element on the page. It does this on DOM mutation events, or failing that, on a timed interval. Unlike the Subtotal Selector, the Variable Subtotal Fallback Selector should be the innermost element containing the actual currency-formatted subtotal. |
| undefined | |
Variable Subtotal Fallback Method
Can be "mutation" or "interval". The default is "mutation". In some cases, the watched element (or one of its ancestors) is completely destroyed and replaced when the subtotal is updated. This renders the mutation observer ineffective. In these cases, the interval method can be used. Although it is inefficient and can be noticeably delayed, the interval method is dependable. | var afterpay_variable_subtotal_fallback_method = "interval"; | "mutation" | |
Dynamic Cart Area | Enable/Disable Clearpay Instalment Message
Some merchants want to see Clearpay calculations on their dynamic cart area. Others don't. Also, due to the complexity of the dynamic cart area, there is a higher likelihood of unexpected or unintended behaviour. This override controls whether or not the Clearpay elements will appear on the dynamic cart area. | v ar clearpay_cart_dynamic_integration_enabled = true; | false |
Logo Theme
This override allows the theme of only this specific placement of the Clearpay logo to be different from the theme globally defined in | var clearpay_cart_dynamic_logo_theme = 'white'; | undefined | |
Custom CSS
Where the Clearpay elements appear inside a dynamic cart area, the CSS of the Clearpay paragraph (the |
| undefined |
Updated 6 months ago