0

We have come across a situation while working on a implementation, below is the sequence of requirement

  1. Some of the users (B2BCustomer), have access to more than one SoldTo (B2BUnit) in the system
  2. Before starting of the commerce journey, user has to choose a SoldTo
  3. Selected SoldTo then marked as ‘DefaultB2BUnit’
  4. Rest of the commerce journey (PLP, Cart, Checkout and Order) is based on selected SoldTo

The challenge here is due to ‘branch’ restriction, user has access to only SoldTo set as ‘DefaultB2BUnit’ and none of the OOTB service let us get the list of all B2BUnit assigned and change the user’s selected one as default. Is there any service available through which we can retrieve all SoldTo’s (B2BUnit) assigned to the user and set one as default after login

Sandra Rossi
  • 11,934
  • 5
  • 22
  • 48

3 Answers3

0

You need to create B2Bunit and assigned it to the B2BCustomer group then all you can read all the groups.

Shahid
  • 21
  • 3
0

Please try following method:

/**
     * Assigns a default unit for a customer who may be a member of multiple units. and modifies a branch for this
     * customers session based on the unit
     *
     * @param customer
     *           The current customer
     * @param unit
     *           A {@link B2BUnitModel} to be assigned as the default for a customer
     */
    void setCurrentUnit(B2BCustomerModel customer, B2BUnitModel unit);
Devendra
  • 1,864
  • 6
  • 29
  • 49
0

As per your requirement, you need to remove the branch restriction.

branch restriction allows customers to access data of their b2b unit and its descendants within one organization hierarchy.

If you don't have a hierarchical structure of b2b units then the branch restriction shouldn't be relevant and can be disabled.

Once you will disable the restriction, then I think your requirement can be implemented easily.

Raushan Kumar
  • 1,195
  • 12
  • 21