use-shopping-cart icon indicating copy to clipboard operation
use-shopping-cart copied to clipboard

Cart Prefix with a namespace scope for managing different carts for platforms

Open dayhaysoos opened this issue 4 years ago • 2 comments

With Stripe Connect apps, it would be ideal to have a way to separate carts for shoppers based on which merchants they are purchasing from

dayhaysoos avatar Sep 08 '20 03:09 dayhaysoos

I'm not sure I completely understand what that entails for use-shopping-cart. Do you want to allow the developer to pass in a string that would be the LocalStorage key? So you'd have

export function CartProvider({ namespace='cart-values', /* other props */ }) {
  /* other code */

  const [cartValues, cartValuesDispatch] = useLocalStorageReducer(
    namespace,
    cartValuesReducer,
    cartValuesInitialState
  )

We could also just call it storageKey instead of namespace if that'd make it more obvious what it was doing.

andria-dev avatar Feb 16 '21 18:02 andria-dev

I like the idea of storageKey, but yeah the idea is to be able to store different carts per merchant based on this storage key

dayhaysoos avatar Feb 16 '21 18:02 dayhaysoos