Instantly share code, notes, and snippets.

Embed
What would you like to do?
Code example on how to change the WooCommerce order status if an AfterPay capture request fails. Should be used together with AfterPay Nordics for WooCommerce (https://wordpress.org/plugins/afterpay-nordics-for-woocommerce/).
<?php
/**
* Change the WooCommerce order status when an AfterPay capture request fails.
* Default failed capture status is processing (since that is usually the order status that the order had before changing to Completed).
*/
add_filter('afterpay_failed_capture_status', 'my_afterpay_failed_capture_status', 10, 2 );
function my_afterpay_failed_capture_status( $status, $order_id ) {
return 'on-hold';
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment