Details
The “Afterpay Gateway for WooCommerce” plugin provides the option to choose Afterpay as the payment method at the checkout. It also provides the functionality to display the Afterpay logo and instalment calculations below product prices on category pages.
Supported Countries
Afterpay for WooCommerce is available for merchants with a store in these countries:
- Australia (🇦🇺)
- New Zealand (🇳🇿)
- United States (🇺🇸)
- Canada (🇨🇦)
- United Kingdom (🇬🇧) – known as Clearpay
Configuring Afterpay for WooCommerce
- Go to Dashboard > Plugins
- Click on Settings below “Afterpay Gateway for WooCommerce”
- Go to the Core Configuration section.
- Enter the Merchant ID provided by Afterpay into the Merchant ID field.
- Enter the Secret Key provided by Afterpay into the Secret Key field.
- Click the Save changes
Enable Express Checkout
- Go to Dashboard > Plugins
- Click on Settings below “Afterpay Gateway for WooCommerce”
- Find Express Checkout Configuration
- enable the checkbox of “Enable on cart page”.
Shortcode
Afterpay WooCommerce integration provides below shortcodes.
Shortcode | Details |
---|---|
afterpay_product_logo | Display the Afterpay logo on individual product pages. |
afterpay_paragraph | Display the Afterpay paragraph for theme builders. |
Filter Hook
Using afterpay_is_product_supported filter hook you can exclude products from Afterpay.
/**
* Determines if a product supports Afterpay.
*
* @param bool $bool_result Whether the product supports Afterpay.
* @param WC_Product $product The product.
*
* @return bool Whether the product supports Afterpay.
*/
function afterpay_ips_callback( $bool_result, $product ) {
if ( $product->get_type() === 'my-custom-product-type' ) {
$bool_result = false;
}
return $bool_result;
}
add_filter( 'afterpay_is_product_supported', 'afterpay_ips_callback', 10, 2 );
FAQ
Why is Afterpay not showing on product pages?
Make sure your WordPress theme has the woocommerce_single_product_summary action hook.Otherwise Afterpay Installment detail will not be visible on the product pages.
Why is Afterpay not showing on category and search result pages?
Make sure the woocommerce_after_shop_loop_item_title action hook is included in your WordPress theme.Otherwise, the category and search result pages will not display Afterpay Installment detail.
Why is Afterpay not showing on the cart page?
Make sure the woocommerce_cart_totals_after_order_total action hook is included in your WordPress theme.Otherwise, the cart page will not display Afterpay Installment detail.
How to change Minimum or Maximum amount on WooCommerce
The Afterpay plugin retrieves merchant account settings from the Afterpay API. This provides the minimum and maximum order values. To propose an increase in the minimum or maximum, fill out this web form.
For New Zealand regions, The delivery option is not available in Express Checkout.
When launching the checkout, the Afterpay plugin requires a postcode to be fetched from WooCommerce. Unfortunately, WooCommerce does not automatically perform this for New Zealand regions. One solution is to change the shipping zone so that it is limited by postcode.
Your Afterpay API credentials are incorrect. (Error ID: cf-worker)
The error message indicates that the Merchant ID is incorrect. Check that you’ve copied the right Merchant ID.
WooCommerce is not updating the order status
When you use the WooCommerce settings option to automatically switch an order from pending payment to canceled, the WooCommerce plugin handles this rather than the payment gateway. In addition, there is no code in the Afterpay Gateway for WooCommerce plugin that specifically prohibits this capability. You can fix this issue by following this tutorial.
Showing error Undefined array key “cbt-limits” WC_Gateway_Afterpay.php
It appears that the array key is now unchecked in the plugin. Go to the plugin settings (Dashboard > WooCommerce > Settings > Payments > Afterpay) and click on Save Changes. It should generate the array key and remove the warning.
Inputting the Merchant Id/Secret Key displays Call to undefined function Afterpay\SDK\HTTP\curl_init()
One requirement for the Afterpay plugin is the cURL library for PHP. This issue usually occurs when the PHP cURL library is not installed on the server. Please raise a request with the website administrator or hosting provider to install and enable this library.