Skip to content

Instantly share code, notes, and snippets.

@shethj
shethj / Readme.md
Last active March 17, 2025 08:30
Merge basket utility functions using Script API for SFRA & SiteGenesis storefronts.

Merge Basket utility functions using Script API

You can implement merge baskets using existing Script API. A recommended approach is to append to existing SFRA/SG controllers where a shopper can log in and implement functionality to then merge baskets as shown in the scripts below.

How to use this script

In a custom SFRA/SG cartridge, extend the Login functionality using server.extend() and server.append() functions like so:

*/cartridges/controllers/Account.js

@shethj
shethj / README.md
Last active October 25, 2024 06:55
Sample overrides/app/routes.jsx to support hybrid deployment - Non Extensibility

Sample app/routes.jsx to support hybrid deployment - Non Extensibility

This gist includes sample code which supports hybrid deployment in PWA Kit retail react app. This code mainly demonstrates updating routes in a PWA Kit project generated using version 3.0.0 later with extensibility disabled.

@shethj
shethj / Readme.md
Last active January 16, 2025 16:52

Sample overrides/app/routes.jsx to support hybrid deployment

This gist includes sample code which supports hybrid deployment in PWA Kit retail react app. This code mainly demonstrates overriding routes in a PWA Kit project generated using version 3.0.0 or later with extensibility enabled.

@shethj
shethj / Readme.md
Last active October 25, 2024 06:56

Sample Auth.js to support hybrid deployment

This gist includes sample code which supports hybrid deployment in PWA Kit retail react app. The major changes are in auth.js where the authentication module supports storing auth tokens as cookies and login(..) function calls the /sessions OCAPI endpoint to bridge sessions between PWA Kit and SFRA sites.

If you generated a PWA Kit project prior to v2.7.1, you need to adopt the changes from this file in your project.

Code diffs are available in the PR: https://github.com/SalesforceCommerceCloud/pwa-kit/pull/1159/files