Advanced configuration
Advanced configuration
The 'Clearpay Gateway for WooCommerce' plugin can be extended and customised without changing any plugin code.
Hooks
The Clearpay plugin runs a series of checks to determine whether Clearpay should be an available payment option for each product. Some third-party plugins can exclude Clearpay from products that would otherwise be considered supported. This can be done by attaching to the following filter hook:
clearpay_is_product_supported
For example:
/**
* @param bool $bool_result
* @param WC_Product $product
*/
function clearpay_ips_callback( $bool_result, $product ) {
# My custom products don't support Clearpay.
if ($product->get_type() == 'my-custom-product-type') {
$bool_result = false;
}
return $bool_result;
}
add_filter( 'clearpay_is_product_supported', 'clearpay_ips_callback', 10, 2 );
Various WooCommerce hooks are assumed to be implemented by the active WordPress theme. Clearpay methods can be detached from their default hooks and reattached to different hooks, or to the same hooks with different priorities.
Since version 2.1.0, hooks and priorities can be customised from within the plugin settings page.
Shortcodes
This is provided for rendering an advanced img
tag for displaying the Clearpay logo on individual product pages. The img
tag uses the srcset
attribute to include 3 different resolutions of the logo for screens with varying pixel density ratios.
[clearpay_product_logo]
There are 3 different versions of the logo to chose from:
colour
black
white
The default theme is colour
. This can be overridden by including a theme
attribute inside the shortcode. For example, if you have a dark themed website and wish to use the white mono version of the Clearpay logo:
[clearpay_product_logo theme="white"]
Updated about 1 month ago