diff --git a/readme.txt b/readme.txt index 7770ad3..7dc70f2 100644 --- a/readme.txt +++ b/readme.txt @@ -2,8 +2,8 @@ Contributors: wphostingdev, iverok, perwilhelmsen, nikolaidev, lassepladsen Tags: woocommerce, vipps, mobilepay Tags: woocommerce, vipps -Version: 3.0.4 -Stable tag: 3.0.4 +Version: 3.0.5 +Stable tag: 3.0.5 Requires at least: 6.2 Tested up to: 6.7.0 Requires PHP: 7.0 @@ -94,10 +94,7 @@ Shareable links and QR codes can be generated from the Vipps tab on the product This project is hosted on Github at: https://github.com/vippsas/vipps-woocommerce == Upgrade Notice == -Version 3.0.4 Fixes issues with too small images uploaded to Vipps and loads strings with translations later to avoid trigging error-logging -Version 3.0.4 Fixes issue where zero-value fees would make purchases impossible -Version 3.0.2 Fixes support of Klarna Payments as an external payment method -Version 3.0.1 fixes an issue in the Gutenberg Checkout block where issues with Vipps/Mobilepay were turned into fatal errors. +Version 3.0.5 Fixes compatibility issues with Checkout, Checkout for Recurring, WooCommerce Subscriptions and Gutenberg Checkout block In version 3.0.0 we are introducing an all-new settings screen reached from the Vipps Mobilpay menu. The old settings page will redirect to this. It should look and feel familiar, but we're going to use this page to hopefully improve the co nfiguraton experience as the features improve and the settings grow more complicated. We also support the new block-based product editor from this version on. @@ -243,6 +240,8 @@ From version 1.1.13 you can also modify the javascript using the new WP hooks li * 'vippsStatusCheckErrorHandler' - A filter that should return function taking a statustext and an error object. It receives the default error handler, and is called when checking the order status with ajax for some reason ends up in an error. == Changelog == += 2024-11-xx version 3.0.5 = +Fixes compatibility issues with Checkout, Checkout for Recurring, WooCommerce Subscriptions and Gutenberg Checkout block = 2024-11-12 version 3.0.4 = Fixes an issue with too small images being uploaded to Vipps for orders diff --git a/woo-vipps-compatibility.php b/woo-vipps-compatibility.php index 1a2ebf4..fea2789 100644 --- a/woo-vipps-compatibility.php +++ b/woo-vipps-compatibility.php @@ -210,15 +210,34 @@ function woo_vipps_remove_no_ajax() { // Anti-support for WooCommerce subscriptions; but allow turning it off using an (advanced) setting or filter. IOK 2021-10-26 +// Turn off on "pay for order" too add_filter('woo_vipps_is_available', function ($ok, $gateway) { if (!$ok) return $ok; // Can't do these, so remove Vipps as payment method IOK 2021-05-14 - if (class_exists( 'WC_Subscriptions_Cart' ) && WC_Subscriptions_Cart::cart_contains_subscription()) { - $ok = ($gateway->get_option('support_subscription_cart') == 'yes'); - $ok = apply_filters('woo_vipps_support_subscription_cart', $ok); + if (class_exists( 'WC_Subscriptions_Cart')) { + $paying_for_order = absint( get_query_var( 'order-pay' ) ); + if (WC_Subscriptions_Cart::cart_contains_subscription()) { + $ok = false; + } + if (function_exists('wcs_cart_contains_renewal') && wcs_cart_contains_renewal()) { + $ok = false; + } + if ($paying_for_order && class_exists('WC_Subscriptions_Product')) { + $order = wc_get_order($paying_for_order); + if (is_a($order,'WC_Order')) { + foreach ( $order->get_items() as $item_id => $item ) { + if (is_a($item, 'WC_Order_Item_Product')) { + $prod = $item->get_product(); + if (is_a($prod, 'WC_Product')) { + if (WC_Subscriptions_Product::is_subscription($prod)) { + $ok = false; break; + } + } + } + } + } + } + $ok = apply_filters('woo_vipps_support_subscription_cart', $ok); } return $ok; }, 10, 2); - - - diff --git a/woo-vipps.php b/woo-vipps.php index 8d998f6..60bc67f 100644 --- a/woo-vipps.php +++ b/woo-vipps.php @@ -7,8 +7,8 @@ Author URI: https://www.wp-hosting.no/ Text-domain: woo-vipps Domain Path: /languages - Version: 3.0.4 - Stable tag: 3.0.4 + Version: 3.0.5 + Stable tag: 3.0.5 Requires at least: 6.2 Tested up to: 6.7.0 Requires PHP: 7.0 @@ -49,7 +49,7 @@ // Report version externally -define('WOO_VIPPS_VERSION', '3.0.4'); +define('WOO_VIPPS_VERSION', '3.0.5'); if ( ! defined( 'ABSPATH' ) ) { exit; // Exit if accessed directly