Automattic\WooCommerce\Blocks\Domain\Services

DraftOrders::init()publicWC 1.0

Set all hooks related to adding Checkout Draft order functionality to Woo Core.

Method of the class: DraftOrders{}

No Hooks.

Return

null. Nothing (null).

Usage

$DraftOrders = new DraftOrders();
$DraftOrders->init();

DraftOrders::init() code WC 8.6.1

public function init() {
	add_filter( 'wc_order_statuses', [ $this, 'register_draft_order_status' ] );
	add_filter( 'woocommerce_register_shop_order_post_statuses', [ $this, 'register_draft_order_post_status' ] );
	add_filter( 'woocommerce_analytics_excluded_order_statuses', [ $this, 'append_draft_order_post_status' ] );
	add_filter( 'woocommerce_valid_order_statuses_for_payment', [ $this, 'append_draft_order_post_status' ] );
	add_filter( 'woocommerce_valid_order_statuses_for_payment_complete', [ $this, 'append_draft_order_post_status' ] );
	// Hook into the query to retrieve My Account orders so draft status is excluded.
	add_action( 'woocommerce_my_account_my_orders_query', [ $this, 'delete_draft_order_post_status_from_args' ] );
	add_action( 'woocommerce_cleanup_draft_orders', [ $this, 'delete_expired_draft_orders' ] );
	add_action( 'admin_init', [ $this, 'install' ] );
}