WooCommerce::init()publicWC 1.0

Init WooCommerce when WordPress Initialises.

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

Хуки из метода

Возвращает

null. Ничего.

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

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

Код WooCommerce::init() WC 7.1.0

public function init() {
	/**
	 * Action triggered before WooCommerce initialization begins.
	 */
	do_action( 'before_woocommerce_init' ); // phpcs:ignore WooCommerce.Commenting.CommentHooks.MissingSinceComment

	// Set up localisation.
	$this->load_plugin_textdomain();

	// Load class instances.
	$this->product_factory                     = new WC_Product_Factory();
	$this->order_factory                       = new WC_Order_Factory();
	$this->countries                           = new WC_Countries();
	$this->integrations                        = new WC_Integrations();
	$this->structured_data                     = new WC_Structured_Data();
	$this->deprecated_hook_handlers['actions'] = new WC_Deprecated_Action_Hooks();
	$this->deprecated_hook_handlers['filters'] = new WC_Deprecated_Filter_Hooks();

	// Classes/actions loaded for the frontend and for ajax requests.
	if ( $this->is_request( 'frontend' ) ) {
		wc_load_cart();
	}

	$this->load_webhooks();

	/**
	 * Action triggered after WooCommerce initialization finishes.
	 */
	do_action( 'woocommerce_init' ); // phpcs:ignore WooCommerce.Commenting.CommentHooks.MissingSinceComment
}