WooCommerce::init
Init WooCommerce when WordPress Initialises.
Method of the class: WooCommerce{}
Hooks from the method
Returns
null. Nothing (null).
Usage
$WooCommerce = new WooCommerce(); $WooCommerce->init();
WooCommerce::init() WooCommerce::init code WC 10.7.0
public function init() {
// See the comment inside FeaturesController::__construct.
wc_get_container()->get( FeaturesController::class )->register_additional_features();
/**
* 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
}