Skip to main content

changeDistributor

@combeenation/custom-code-utils


Function: changeDistributor()

changeDistributor(distributorName, copyCfgnValues): Promise<void>

Change the current configuration to the given distributor or the company (if left empty).
Note: Although there's a seamless transition to the distributor it should be used sparingly, as it creates new configurations in the background.

Parameters

distributorName

string

name of the distributor to switch to, or null to switch to company

copyCfgnValues

boolean = true

true to copy all cfgn values (input), false to use an empty cfgn

Returns

Promise<void>

Example

CfgrUtils.onBeforeCheckout(async () => {
if (country === 'AT') {
await CfgrUtils.changeDistributor('distributorAT');
}
});