In Enterprise Sales Management, when you add a child product to the working cart, the working cart Lightning web component doesn’t refresh. To automatically refresh the working cart Lightning web component, you must extend addProductToCartPostHook by extending the b2bSampleApp and b2bOfferConfig components.
Required Editions
This feature is part of the Communications Cloud managed package.
| Available in: Lightning Experience |
| Available in: Enterprise, Unlimited, and Developer Editions |
| Required User Permissions | |
|---|---|
| To configure Lightning web components: | Communications Cloud Admin |
- From the App Launcher, find and select LWC Designer.
- To create a custom Lightning web component, click +LWC.
- On the Extend tab, enter customB2bOfferConfig as the name of the Lightning web component.
- Select b2bOfferConfig as the Lightning web component.
- Select Include XML Targets and Omniscript Support.
- Click Create.
- Select customB2bOfferConfig.js as the file.
-
In the Editor, enter the JavaScript code. Use this sample code.
import B2bOfferConfig from 'vlocity_cmt/b2bOfferConfig'; export default class customB2bOfferConfig extends B2bOfferConfig { addProductToCartPostHook(response) { Promise.resolve().then(() => { this.getCartItemsCall(); }); } connectedCallback() { super.connectedCallback(); } } - Save your changes.
- Select customB2bOfferConfig.js-meta.xml as the file.
-
In the Editor, add this line:
<runtimeNamespace>vlocity_cmt</runtimeNamespace>. - Save your changes.
- To create another custom Lightning web component, click +LWC.
- On the Extend tab, enter customB2bSampleApp as the name of the Lightning web component.
- Select b2bSampleApp as the Lightning web component.
- Select Include HTML, Include XML Targets, and Omniscript Support.
- Click Create.
- Select customB2bSampleApp.html as the file.
- In the Editor, enter the entire HTML code from b2bSampleApp.
-
Replace
<vlocity_cmt-b2b-offer-config></vlocity_cmt-b2b-offer-config>with<c-custom-b2b-offer-config></c-custom-b2b-offer-config>. - Save your changes.
- Select customB2bSampleApp.js as the file.
-
In the Editor, enter the JavaScript code. Use this sample code.
import B2bSampleApp from 'vlocity_cmt/b2bSampleApp'; export default class customB2bSampleApp extends B2bSampleApp { connectedCallback() { super.connectedCallback(); } } - Save your changes.
Deploy the custom Lightning web component to Enterprise Sales Management, see Customize Buttons, Actions, or Fields in Enterprise Sales Management.