Fix Deprecated dynamic property errors in php 8.2 (#44896)

The `\WC_Checkout::create_order_line_items` method assigns values to properties of the `WC_Order_Item_Product` class which did not exist.

PHP Deprecated:  Creation of dynamic property WC_Order_Item_Product::$legacy_values

PHP Deprecated:  Creation of dynamic property WC_Order_Item_Product::$legacy_cart_item_key

Fixes #38857

---------

Co-authored-by: Néstor Soriano <konamiman@konamiman.com>
This commit is contained in:
Mat Lipe 2024-02-28 10:32:32 -05:00 committed by GitHub
parent bfa3ffb125
commit b160cab657
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 19 additions and 0 deletions

View File

@ -0,0 +1,4 @@
Significance: patch
Type: tweak
Make dynamic properties explicit in WC_Order_Item

View File

@ -16,6 +16,21 @@ defined( 'ABSPATH' ) || exit;
* Order item class.
*/
class WC_Order_Item extends WC_Data implements ArrayAccess {
/**
* Legacy cart item values.
*
* @deprecated 4.4.0 For legacy actions.
* @var array
*/
public $legacy_values;
/**
* Legacy cart item keys.
*
* @deprecated 4.4.0 For legacy actions.
* @var string
*/
public $legacy_cart_item_key;
/**
* Order Data array. This is the core order data exposed in APIs since 3.0.0.