slejnej
Forum Replies Created
Viewing 1 replies (of 1 total)
-
Forum: Plugins
In reply to: [WooCommerce] Fatal error after update 3.6.2.Hi,
as per latest update 3.6.3 (removed entirely and copied extracted zip) still same error of
WC()->cartis null in custom functions. None of the tips above helped. Even usingglobal $woocommercedid not return cart. TriedWC()->frontend_includes()and still no access. Checked what is included and there is no access in that for actual WC().This is the fix that I’ve found in code for CoCart
if ( version_compare( WC_VERSION, '3.6.0', '>=' ) && WC()->is_rest_api_request() == 'wc/' ) { require_once( WC_ABSPATH . 'includes/wc-cart-functions.php' ); require_once( WC_ABSPATH . 'includes/wc-notice-functions.php' ); if ( null === WC()->session ) { $session_class = apply_filters( 'woocommerce_session_handler', 'WC_Session_Handler' ); // Prefix session class with global namespace if not already namespaced if ( false === strpos( $session_class, '\\' ) ) { $session_class = '\\' . $session_class; } WC()->session = new $session_class(); WC()->session->init(); } if ( null === WC()->customer ) { if ( is_user_logged_in() ) { WC()->customer = new WC_Customer( get_current_user_id() ); } else { WC()->customer = new WC_Customer( get_current_user_id(), true ); } } if ( null === WC()->cart ) { WC()->cart = new WC_Cart(); } }
Viewing 1 replies (of 1 total)