Automattic\WooCommerce\Blocks\BlockTypes
MiniCartFooterBlock::get_cart_instance
Return the main instance of WC_Cart class.
Method of the class: MiniCartFooterBlock{}
No Hooks.
Returns
\WC_Cart. CartController class instance.
Usage
// protected - for code of main (parent) or child class $result = $this->get_cart_instance();
MiniCartFooterBlock::get_cart_instance() MiniCartFooterBlock::get cart instance code WC 10.8.1
protected function get_cart_instance() {
$cart = WC()->cart;
if ( $cart && $cart instanceof \WC_Cart ) {
return $cart;
}
return null;
}