Automattic\WooCommerce\Blocks\Domain\Services

DraftOrders::initpublicWC 1.0

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

Метод класса: DraftOrders{}

Хуков нет.

Возвращает

null. Ничего (null).

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

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

Код DraftOrders::init() WC 10.5.0

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' ], 999 );
	add_filter( 'woocommerce_valid_order_statuses_for_payment_complete', [ $this, 'append_draft_order_post_status' ], 999 );
	// 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( self::DRAFT_CLEANUP_EVENT_HOOK, [ $this, 'delete_expired_draft_orders' ] );
	add_action( 'admin_init', [ $this, 'install' ] );

	if ( defined( 'WC_PLUGIN_BASENAME' ) ) {
		add_action( 'deactivate_' . WC_PLUGIN_BASENAME, [ $this, 'unschedule_cronjobs' ] );
	}
}