From 3a1c4caf6d22eee50df25a78180e8d1acb2343b3 Mon Sep 17 00:00:00 2001 From: Giovanni-Schroevers Date: Mon, 23 Feb 2026 15:15:14 +0100 Subject: [PATCH] fix: prevent sort filter from flipping direction to DESC after using the pagination --- .changeset/puny-hounds-stare.md | 5 +++++ packages/magento-product/hooks/useProductListLink.ts | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) create mode 100644 .changeset/puny-hounds-stare.md diff --git a/.changeset/puny-hounds-stare.md b/.changeset/puny-hounds-stare.md new file mode 100644 index 00000000000..85183291dba --- /dev/null +++ b/.changeset/puny-hounds-stare.md @@ -0,0 +1,5 @@ +--- +'@graphcommerce/magento-product': patch +--- + +Prevent sort filter from flipping direction to DESC after using the pagination diff --git a/packages/magento-product/hooks/useProductListLink.ts b/packages/magento-product/hooks/useProductListLink.ts index de20229806d..86e25a8ca86 100644 --- a/packages/magento-product/hooks/useProductListLink.ts +++ b/packages/magento-product/hooks/useProductListLink.ts @@ -27,7 +27,7 @@ export function productListLinkFromFilter(props: ProductFilterParams): string { // todo(paales): How should the URL look like with multiple sorts? // Something like: /sort/position,price/dir/asc,asc if (sort) query += `/sort/${sort}` - if (dir) query += '/dir/desc' + if (dir === 'DESC') query += '/dir/desc' if (pageSize) query += `/page-size/${pageSize}` // Apply filters