WC_Checkout::instance()public staticWC 2.1

Gets the main WC_Checkout Instance.

Method of the class: WC_Checkout{}

Hooks from the method

Return

WC_Checkout. Main instance

Usage

$result = WC_Checkout::instance();

Changelog

Since 2.1 Introduced.

WC_Checkout::instance() code WC 8.7.0

public static function instance() {
	if ( is_null( self::$instance ) ) {
		self::$instance = new self();

		// Hook in actions once.
		add_action( 'woocommerce_checkout_billing', array( self::$instance, 'checkout_form_billing' ) );
		add_action( 'woocommerce_checkout_shipping', array( self::$instance, 'checkout_form_shipping' ) );

		/**
		 * Runs once when the WC_Checkout class is first instantiated.
		 *
		 * @since 3.0.0 or earlier
		 */
		do_action( 'woocommerce_checkout_init', self::$instance );
	}
	return self::$instance;
}