From a6ef06ca537c7c3678ca225c816352b6470d26f1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gon=C3=A7alo=20Figueiredo?= Date: Mon, 23 Oct 2023 17:01:43 +0100 Subject: [PATCH] Unserialize cart data for "complete purchase" hook edd_get_order_item_meta() is called without defining a metakey, which in turn uses get_metadata() to get all the order's metadata. When a metakey is not set in get_metadata(), WordPress doesn't unserialize the data (see last portion of get_metadata_raw()). --- includes/payments/actions.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/includes/payments/actions.php b/includes/payments/actions.php index fd28f0ca47..0dc54845e6 100755 --- a/includes/payments/actions.php +++ b/includes/payments/actions.php @@ -108,7 +108,7 @@ function edd_complete_purchase( $order_id, $new_status, $old_status ) { if ( ! empty( $order_item_meta ) ) { foreach ( $order_item_meta as $item_meta_key => $item_meta_value ) { if ( '_option_' === substr( $item_meta_key, 0, 8 ) && isset( $item_meta_value[0] ) ) { - $item_options[ str_replace( '_option_', '', $item_meta_key ) ] = $item_meta_value[0]; + $item_options[ str_replace( '_option_', '', $item_meta_key ) ] = maybe_unserialize( $item_meta_value[0] ); } } }