diff --git a/packages/sfcc/.env.template b/packages/sfcc/.env.template index 7417bc8c7..a649427b2 100644 --- a/packages/sfcc/.env.template +++ b/packages/sfcc/.env.template @@ -1 +1,7 @@ -COMMERCE_PROVIDER=@vercel/commerce-sfcc \ No newline at end of file +COMMERCE_PROVIDER=@vercel/commerce-sfcc + +SFCC_CLIENT_ID= +SFCC_CLIENT_SECRET= +SFCC_ORG_ID= +SFCC_SHORT_CODE= +SFCC_SITE_ID= \ No newline at end of file diff --git a/packages/sfcc/README.md b/packages/sfcc/README.md index 527f6e281..42448e18d 100644 --- a/packages/sfcc/README.md +++ b/packages/sfcc/README.md @@ -1,7 +1,38 @@ # Next.js SalesForce Cloud Commerce Provider +## Installation + +1. Copy the `.env.template` file in this directory (`/packages/sfcc`) to `/site/.env.local` in the main directory +2. `yarn` in root folder +3. `yarn dev` in root folder -refrences: -- https://github.com/SalesforceCommerceCloud/commerce-sdk-isomorphic -- https://github.com/SalesforceCommerceCloud/commerce-sdk \ No newline at end of file +## Features: +```json +{ + "provider": "sfcc", + "features": { + "wishlist": false, + "cart": false, + "search": true, + "customerAuth": false, + "customCheckout": false + } +} +``` + +## Refrences: + - 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/ + +## Training Material and Documentation: +For a detailed introduction into commerce clouds feature set and data setup please refer to our Training Material and Documentation: + +Salesforce Trailhead for B2C Commerce Cloud: https://trailhead.salesforce.com/en/content/learn/trails/cc-overview +Salesforce Trailhead for Development on B2C Commerce Cloud: https://trailhead.salesforce.com/en/content/learn/trails/develop-for-commerce-cloud + +B2C Commerce Cloud Documentation:https://documentation.b2c.commercecloud.salesforce.com/DOC1/index.jsp +B2C Commerce Cloud Open Commerce API Doc: https://documentation.b2c.commercecloud.salesforce.com/DOC1/topic/com.demandware.dochelp/OCAPI/current/usage/OpenCommerceAPI.html?cp=0_15 +Developer Center for Commerce Cloud (Commerce APIs specifically): https://developer.salesforce.com/docs/commerce/commerce-api/overview +SLAS Org Admin Setup Guide: https://developer.salesforce.com/docs/commerce/commerce-api/references?meta=slas-admin:Summary \ No newline at end of file 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 49d1234cf..2e286ee4c 100644 --- a/packages/sfcc/src/api/endpoints/catalog/products/get-products.ts +++ b/packages/sfcc/src/api/endpoints/catalog/products/get-products.ts @@ -16,6 +16,11 @@ const getProducts: ProductsEndpoint['handlers']['getProducts'] = async ({ searchTerm = categoryId as string } + // set default for main category + if (!searchTerm) { + searchTerm = 'clothing' + } + const searchClient = await sdk.getSearchClient(); // use SDK search API for initial products const searchResults = await searchClient.productSearch({ diff --git a/site/.env.template b/site/.env.template index 0ec612890..70ce9cf54 100644 --- a/site/.env.template +++ b/site/.env.template @@ -48,3 +48,9 @@ KIBO_API_HOST= NEXT_PUBLIC_COMMERCEJS_PUBLIC_KEY= NEXT_PUBLIC_COMMERCEJS_DEPLOYMENT_URL= + +SFCC_CLIENT_ID= +SFCC_CLIENT_SECRET= +SFCC_ORG_ID= +SFCC_SHORT_CODE= +SFCC_SITE_ID= \ No newline at end of file