woocommerce_abandoned_cart_recovery_eligible_statuses хук-фильтрWC 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()

Использование

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.

Список изменений

С версии 11.0.0 Введена.

Где вызывается хук

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
);

Где используется хук в WooCommerce

Использование не найдено.