From 31775d683592ae89663d50c6979efe3523d29140 Mon Sep 17 00:00:00 2001 From: Bart Kalisz Date: Wed, 11 Sep 2024 18:32:22 +0200 Subject: [PATCH] Improve the query merging logic --- .../js/blocks/product-collection/collections/hand-picked.tsx | 1 - .../woocommerce/src/Blocks/BlockTypes/ProductCollection.php | 5 ++--- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/plugins/woocommerce-blocks/assets/js/blocks/product-collection/collections/hand-picked.tsx b/plugins/woocommerce-blocks/assets/js/blocks/product-collection/collections/hand-picked.tsx index 9194e1b8764..534121e04f2 100644 --- a/plugins/woocommerce-blocks/assets/js/blocks/product-collection/collections/hand-picked.tsx +++ b/plugins/woocommerce-blocks/assets/js/blocks/product-collection/collections/hand-picked.tsx @@ -62,7 +62,6 @@ const attributes = { }, query: { orderBy: 'post__in', - order: 'desc', perPage: 5, pages: 1, }, diff --git a/plugins/woocommerce/src/Blocks/BlockTypes/ProductCollection.php b/plugins/woocommerce/src/Blocks/BlockTypes/ProductCollection.php index e8f704dfb10..4e9cdaddf22 100644 --- a/plugins/woocommerce/src/Blocks/BlockTypes/ProductCollection.php +++ b/plugins/woocommerce/src/Blocks/BlockTypes/ProductCollection.php @@ -19,7 +19,7 @@ class ProductCollection extends AbstractBlock { */ protected $block_name = 'product-collection'; - /** + /** * An associative array of collection handlers. * * @var array $collection_handler_store @@ -55,7 +55,6 @@ class ProductCollection extends AbstractBlock { */ protected $custom_order_opts = array( 'popularity', 'rating', 'post__in' ); - /** * The render state of the product collection block. * @@ -1012,7 +1011,7 @@ class ProductCollection extends AbstractBlock { * @return array */ private function get_custom_orderby_query( $orderby ) { - if ( ! in_array( $orderby, $this->custom_order_opts, true ) ) { + if ( ! in_array( $orderby, $this->custom_order_opts, true ) || 'post__in' === $orderby ) { return array( 'orderby' => $orderby ); }