woocommerce_abandoned_cart_recovery_eligible_statuses filter-hookWC 11.0.0

Filter the order statuses that are eligible to receive the abandoned cart recovery email.

The filter is applied at two points in the order lifecycle, which pass different defaults because they cover different statuses:

  • At send time (here), the default is pending and checkout-draft, covering abandonment from both the classic and the block checkout, used in manual email trigger path from the order edit page.
  • When the automated send is scheduled, the default is pending only. Store API orders are generally created in checkout-draft, which is not supported yet for automatic scheduled email. \Automattic\WooCommerce\Internal\AbandonedCartRecovery\Scheduler::get_eligible_statuses()

Usage

add_filter( 'woocommerce_abandoned_cart_recovery_eligible_statuses', 'wp_kama_woocommerce_abandoned_cart_recovery_eligible_statuses_filter', 10, 2 );

/**
 * Function for `woocommerce_abandoned_cart_recovery_eligible_statuses` filter-hook.
 * 
 * @param string[]      $eligible_statuses Default: `pending` and `checkout-draft` at manual send time, `pending` when scheduling.
 * @param WC_Order|null $order             Order being inspected, or null if it could not be loaded.
 *
 * @return string[]
 */
function wp_kama_woocommerce_abandoned_cart_recovery_eligible_statuses_filter( $eligible_statuses, $order ){

	// filter...
	return $eligible_statuses;
}
$eligible_statuses(string[])
Default: pending and checkout-draft at manual send time, pending when scheduling.
$order(WC_Order|null)
Order being inspected, or null if it could not be loaded.

Changelog

Since 11.0.0 Introduced.

Where the hook is called

WC_Email_Customer_Abandoned_Cart_Recovery::is_order_eligible_for_recovery()
woocommerce_abandoned_cart_recovery_eligible_statuses
Scheduler::get_eligible_statuses()
woocommerce_abandoned_cart_recovery_eligible_statuses
woocommerce/includes/emails/class-wc-email-customer-abandoned-cart-recovery.php 285-289
$eligible_statuses = (array) apply_filters(
	'woocommerce_abandoned_cart_recovery_eligible_statuses',
	self::ABANDONED_STATUSES,
	$order
);
woocommerce/src/Internal/AbandonedCartRecovery/Scheduler.php 260-264
return (array) apply_filters(
	'woocommerce_abandoned_cart_recovery_eligible_statuses',
	array( OrderStatus::PENDING ),
	$order
);

Where the hook is used in WooCommerce

Usage not found.