Skip to content

Commit

Permalink
Fix Deprecated dynamic property errors in php 8.2 (#44896)
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
lipemat and Konamiman committed Mar 13, 2024
1 parent ac9c3b9 commit 85209cd
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 0 deletions.
4 changes: 4 additions & 0 deletions plugins/woocommerce/changelog/pr-44896
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
Significance: patch
Type: tweak

Make dynamic properties explicit in WC_Order_Item
15 changes: 15 additions & 0 deletions plugins/woocommerce/includes/class-wc-order-item.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,21 @@
* 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.
Expand Down

0 comments on commit 85209cd

Please sign in to comment.