From 63e1313cc0e927594a51581f3698ec6ba1f9e52f Mon Sep 17 00:00:00 2001 From: Montazar Date: Wed, 14 Aug 2024 10:44:07 +0200 Subject: [PATCH 1/2] Do not call save() when processing order item (#185) Calling save() causes the order ID to return 0 (or sometimes `null`) in the `woocommerce_new_order_item` action hook if the priority is too low. This has caused a compatibility issue with plugins that rely on the order ID to be available. Since the save() is not necessary when processing order items (it is however required for orders), we can safely remove it. Furthermore, we don't need to call `update_meta_data` since the order line is only added once. Instead `add_meta_data` suffices. Tested w/wo HPOS. --- classes/class-dintero-checkout-gateway.php | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/classes/class-dintero-checkout-gateway.php b/classes/class-dintero-checkout-gateway.php index f6239c5..38f01fc 100644 --- a/classes/class-dintero-checkout-gateway.php +++ b/classes/class-dintero-checkout-gateway.php @@ -99,8 +99,7 @@ public function __construct() { * @return void */ public function create_order_line_item( $item, $cart_item_key ) { - $item->update_meta_data( '_dintero_checkout_line_id', $cart_item_key ); - $item->save(); + $item->add_meta_data( '_dintero_checkout_line_id', $cart_item_key, true ); } /** From 8861ec98df50c02a9b8c2f64ff5fb9d8cd5c7cf2 Mon Sep 17 00:00:00 2001 From: Montazar Date: Mon, 19 Aug 2024 12:26:15 +0200 Subject: [PATCH 2/2] Version 1.10.7 --- dintero-checkout-for-woocommerce.php | 4 ++-- readme.txt | 5 ++++- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/dintero-checkout-for-woocommerce.php b/dintero-checkout-for-woocommerce.php index f7c7833..f99d26d 100644 --- a/dintero-checkout-for-woocommerce.php +++ b/dintero-checkout-for-woocommerce.php @@ -5,7 +5,7 @@ * Description: Dintero offers a complete payment solution. Simplifying the payment process for you and the customer. * Author: Dintero, Krokedil * Author URI: https://krokedil.com/ - * Version: 1.10.6 + * Version: 1.10.7 * Text Domain: dintero-checkout-for-woocommerce * Domain Path: /languages * @@ -22,7 +22,7 @@ exit; } -define( 'DINTERO_CHECKOUT_VERSION', '1.10.6' ); +define( 'DINTERO_CHECKOUT_VERSION', '1.10.7' ); define( 'DINTERO_CHECKOUT_URL', untrailingslashit( plugins_url( '/', __FILE__ ) ) ); define( 'DINTERO_CHECKOUT_PATH', untrailingslashit( plugin_dir_path( __FILE__ ) ) ); define( 'DINTERO_CHECKOUT_MAIN_FILE', __FILE__ ); diff --git a/readme.txt b/readme.txt index bba92f6..0f0a8f9 100644 --- a/readme.txt +++ b/readme.txt @@ -6,7 +6,7 @@ Tested up to: 6.4.1 Requires PHP: 7.0 WC requires at least: 6.1.0 WC tested up to: 8.2.1 -Stable tag: 1.10.6 +Stable tag: 1.10.7 License: GPLv3 or later License URI: http://www.gnu.org/licenses/gpl-3.0.html @@ -82,6 +82,9 @@ Go to [https://www.dintero.com/contact-us](https://www.dintero.com/contact-us) t 1. The plugin settings screen where you set up the details to connect to Dintero. == Changelog == += 2024.08.19 - version 1.10.7 = +* Fix - Fixed an issue related to 'woocommerce_new_order_item' where calling save() would result in the order ID being set to 0. This should improve compatibility with other third-party plugins that hook onto this action. + = 2024.07.11 - version 1.10.6 = * Fix - Fixed an issue related to the plugin settings overhaul. The setting migration should now work as intended. Please verify that the new "Checkout flow" plugin setting option is what you expect.