SwedbankPay / swedbank-pay-woocommerce-core

Swedbank Pay WooCommerce Core
https://packagist.org/packages/swedbank-pay/swedbank-pay-woocommerce-core
Apache License 2.0
0 stars 5 forks source link

Deprecated use of $order->update_meta_data('_transaction_id', $id ) #80

Closed lakrisgubben closed 2 years ago

lakrisgubben commented 2 years ago

Hey,

we're getting some deprecation notices from WooCommerce (6.6.1) due to this line https://github.com/SwedbankPay/swedbank-pay-woocommerce-core/blob/main/src/SwedbankPay/Core/Adapter/WC_Adapter.php#L664

The deprecation notice is:

is_internal_meta_key was called incorrectly. Generic add/update/get meta methods should not be used for internal meta data, including ”_transaction_id”. Use getters and setters. Backtrace: require('wp-admin/admin-ajax.php'), do_action('wp_ajax_swedbank_pay_check_payment'), WP_Hook->do_action, WP_Hook->apply_filters, WC_Gateway_Swedbank_Pay_Cc->ajax_check_payment, SwedbankPay\Core\Core->fetchTransactionsAndUpdateOrder, SwedbankPay\Core\Core->processTransaction, SwedbankPay\Core\Core->updateOrderStatus, SwedbankPay\Core\Adapter\WC_Adapter->updateOrderStatus, WC_Data->update_meta_data, WC_Data->is_internal_meta_key, wc_doing_it_wrong. This message was added in version 3.2.0.

To solve this the line should be changed to $order->set_transaction_id($transactionNumber);