diff --git a/plugins/woocommerce/changelog/fix-php-warning b/plugins/woocommerce/changelog/fix-php-warning new file mode 100644 index 00000000000..4a511ec5319 --- /dev/null +++ b/plugins/woocommerce/changelog/fix-php-warning @@ -0,0 +1,4 @@ +Significance: patch +Type: tweak + +Product Collection: fix the PHP deprecated warning diff --git a/plugins/woocommerce/src/Blocks/BlockTypes/ProductCollection.php b/plugins/woocommerce/src/Blocks/BlockTypes/ProductCollection.php index 6b94f719973..45f5ab2b48e 100644 --- a/plugins/woocommerce/src/Blocks/BlockTypes/ProductCollection.php +++ b/plugins/woocommerce/src/Blocks/BlockTypes/ProductCollection.php @@ -226,7 +226,7 @@ class ProductCollection extends AbstractBlock { 'data-wc-navigation-id', 'wc-product-collection-' . $this->parsed_block['attrs']['queryId'] ); - $current_context = json_decode( $p->get_attribute( 'data-wc-context' ), true ) ?? []; + $current_context = json_decode( $p->get_attribute( 'data-wc-context' ) ?? '{}', true ); $p->set_attribute( 'data-wc-context', wp_json_encode(