version, '8.6.0', '>='); // Only load if the feature flag is enabled. $is_product_editor_v2_enabled = get_option('woocommerce_feature_product_block_editor_enabled'); if($is_version_supported && $is_product_editor_v2_enabled) { // Load the new blocks require_once(dirname(__FILE__) . '/admin/blocks/register-woo-blocks.php'); // Load the V2 product editor require_once(dirname(__FILE__) . '/VippsWCProductEditorV2.class.php'); VippsWCProductEditorV2::register_hooks(); } }); add_action ('before_woocommerce_init', function () { $url = sanitize_text_field($_SERVER['REQUEST_URI']); # This removes cookies for the wc-api callback events for the vipps plugin, to be 100% sure no sessions are restored when they ought not be IOK 2020-07-01 # Re-added and modified IOK 2022-06-20 if (preg_match('!(wc_gateway_vipps|vipps_shipping_details|vipps-consent-removal)!', $url) && preg_match('!\bwc-api\b!', $url)) { // Disallow woo from setting any cookies for these URLs. This happens very early, so we need to do this a bit awkwardly. add_filter('woocommerce_set_cookie_enabled', function ($val,$name ,$value, $expire, $secure) { return false; }, 999, 5); // Any cookies that was previously set: Remove them. foreach($_COOKIE as $key=>$value) unset($_COOKIE[$key]); } },1); // Load the extra Vipps Checkout Shipping classes only when necessary add_action( 'woocommerce_shipping_init', function () { if (!class_exists('VippsCheckout_Shipping_Method') && get_option('woo_vipps_checkout_activated', false)) { require_once(dirname(__FILE__) . '/VippsCheckoutShippingMethods.php'); } });