From 9e3dff34c0a839e2b713265567a537b600a368db Mon Sep 17 00:00:00 2001 From: Daniel Dudzic Date: Mon, 30 Oct 2023 18:56:04 +0100 Subject: [PATCH] Product Collection: Fix the undefined array key 'woocommerceAttributes' warning after migrating from Products (Beta) (https://github.com/woocommerce/woocommerce-blocks/pull/11494) --- .../woocommerce-blocks/src/BlockTypes/ProductCollection.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/plugins/woocommerce-blocks/src/BlockTypes/ProductCollection.php b/plugins/woocommerce-blocks/src/BlockTypes/ProductCollection.php index eef32cfa7b5..675608d28d2 100644 --- a/plugins/woocommerce-blocks/src/BlockTypes/ProductCollection.php +++ b/plugins/woocommerce-blocks/src/BlockTypes/ProductCollection.php @@ -302,6 +302,7 @@ class ProductCollection extends AbstractBlock { ); $is_on_sale = $query['woocommerceOnSale'] ?? false; + $product_attributes = $query['woocommerceAttributes'] ?? []; $taxonomies_query = $this->get_filter_by_taxonomies_query( $query['tax_query'] ?? [] ); $handpicked_products = $query['woocommerceHandPickedProducts'] ?? []; @@ -311,7 +312,7 @@ class ProductCollection extends AbstractBlock { 'on_sale' => $is_on_sale, 'stock_status' => $query['woocommerceStockStatus'], 'orderby' => $query['orderBy'], - 'product_attributes' => $query['woocommerceAttributes'], + 'product_attributes' => $product_attributes, 'taxonomies_query' => $taxonomies_query, 'handpicked_products' => $handpicked_products, ),