autoship_filter_notices_for_all_orders

Can be used to show / hide notices for Scheduled Orders based on the Scheduled Order's status. Currently the failure notice / failure reason is not displayed if the associated Scheduled Order has a status of Active or Pending. This filter takes the current notification, the associated Scheduled Order's status, and the original notification text as parameters. NOTE The ScheduledOrderFailureReason field on a Scheduled Order is not cleared/reset until the next time the Scheduled Order gets processed. This is the initial reason for adding the attached filter so that a user can resume a scheduled order and visually not see the error until it occurs again.

Example

// customize notices for Failed and Paused Scheduled Orders
function xx_change_order_notice($new_notice, $status, $orig_notice)
{
    if ($status == 'Failed') {
        return '<h3 style="color:red;">Your order has failed, please review in My Account > Scheduled Orders or contact merchant to resolve the failure reason.</h3>';
    } elseif ($status == 'Paused') {
        return '<h3 style="color:green;">Your order currently is "Paused". Please review your order (My Account > Scheduled Orders), then resume your order. </h3>';
    }
}
add_filter('autoship_filter_notices_for_all_orders', 'xx_change_order_notice', 10, 3);

Still need help? Contact Us Contact Us