diff --git a/packages/sfcc/README.md b/packages/sfcc/README.md index 04fe392aa..3b419dcf7 100644 --- a/packages/sfcc/README.md +++ b/packages/sfcc/README.md @@ -21,7 +21,7 @@ } ``` -## Refrences: +## References - SDK: https://github.com/SalesforceCommerceCloud/commerce-sdk - isomorphic SDK (currently not used atm): https://github.com/SalesforceCommerceCloud/commerce-sdk-isomorphic - PWA Kit storefront example: https://pwa-kit.mobify-storefront.com/ diff --git a/packages/sfcc/src/api/endpoints/catalog/products/get-products.ts b/packages/sfcc/src/api/endpoints/catalog/products/get-products.ts index 2e286ee4c..eb814f5d7 100644 --- a/packages/sfcc/src/api/endpoints/catalog/products/get-products.ts +++ b/packages/sfcc/src/api/endpoints/catalog/products/get-products.ts @@ -10,16 +10,8 @@ const getProducts: ProductsEndpoint['handlers']['getProducts'] = async ({ }) => { const { sdk } = config; - let searchTerm = search; - - if (categoryId) { - searchTerm = categoryId as string - } - - // set default for main category - if (!searchTerm) { - searchTerm = 'clothing' - } + // 'clothing' is our main category default, and a manually set category has priority + const searchTerm = categoryId ? categoryId as string : search || 'clothing'; const searchClient = await sdk.getSearchClient(); // use SDK search API for initial products