1. Home
  2. Docs
  3. Lightning B2B
  4. Shipping Costs
Log a Case

Lightning B2B Commerce

Provide flexible and customizable shipping costs in Lightning B2B Commerce checkout process. You can mark up, mark down and apply rate cards to specific accounts.

Prerequisites

Before you follow the guide, please ensure you have completed the following prerequisites:

  1. Installed the Multi-carrier app
  2. Installed the Lightning B2B app (sandbox) | (production)
  3. Created a preference with your live credentials or test credentials

Configuration for Lightning B2B

Next, you need to set up the B2B store-front to utilize our Checkout Flow. Follow the steps below to do this.

  1. SF setup-> Feature Settings -> Commerce -> Stores
  2. Open Store Setting
  3. Go to Experience Builder:
  4. Go to Checkout page:
  5. Choose flow 'MC Checkout Flow':
  6. Click Publish Button
  7. Go to Store Setting (Administration), choose 'Shipping Calculation', add our integration
  8. Go to Store Setting, Choose 'Search':
  9. Rebuild Index

Configuration for Sharing Settings

To allow the Guest Access Profile to access our objects you need to follow the steps below:

  1. SF Setup -> Security Controls -> Sharing Settings
  2. Click 'Edit' on Organization-Wide Defaults
  3. Select 'Read-only' for MC B2B Configuration / Custom Address Source / Shipmate Preference / Shipmate Preference Info objects
  4. Select 'Public Read/Write' for MC B2B Log object
  5. Wait for the re-calc process to finish

B2B Commerce Shipping Estimates

Next you need to create the Custom Address Sources to reference the information on the Web Cart object (for shipping rates).

Go to Custom Address Sources and click on the New button, give it a name "B2B Cart"

As per the screenshot above, make sure to select "All Objects", and then find the Web Cart (Cart) object.

Scroll down and fill in the packages section as you see here if you want each items selected to be in its own box:

The Child object collects all the items that are in the cart.

Next you can set the standard fields for getting the service types as you can see here:

To set these values as you see them above (without the [ or ] ) make sure when you select the field you click on the Static Value button:

Very infrequently the carrier servers might have some maintenance window or issues where they no longer return rates. Zenkraft have devised a solution for when this occurs so that the checkout does not fail. We have a timeout section on the Custom Address Source (in milliseconds) that you can set, so if the carrier doesn't respond within 5 seconds (for example), you can utilize fall back rates.

To set the Timeout for the carriers, just add under "Enhanced Functionality Settings" the "All Carriers: Callout Timeout" and set the number in milliseconds. The example below shows a timeout of 5 seconds.

The configuration of the fallback is detailed in the next section.

Your rating custom address source set up is now done. Click on Save. The next step is setting up the Zenkraft B2B Settings.

Configuration for Zenkraft B2B Settings

  1. Go to 'Zenkraft B2B Settings' tab
  2. Register Shipping Class

Configure B2B rate setting

Go to Zenkraft B2B Settings Tab and set the Custom Address Source you added in the previous step.

The next tab we will look at is the Rate Cards.

You will always have a Default Rate Card which you can set up with the Carriers and Service Types as you see fit.

You can add or edit the Rate options as per your needs. In this screenshot you can see that we are setting FedEx Ground as being Free from Shipping costs. If you need to add new options or edit them use the buttons highlighted below:

Once you create/edit a Rate option you can specify the Carrier, the Service Types to include (or exclude) and whether these items should be Free, Fixed or Percentage.

Free means the shipping charge is set to 0.

Fixed means that you can add a margin to the shipping cost by adding the amount. In the screenshot below you can see that we have set the price to be an extra $15. If you don't want to add any margin just set it to 0.

Percentage works along the same lines as Fixed, but instead of a fixed increase, you can add a percentage on top of the shipping cost. So if shipping was $10 and you put a Percentage = 20 then the user would see $12 as the shipping cost.

If you have a requirement to have different rate cards per Account, for example Account ABC gets free Ground Shipping, but if they want to use Overnight, then they will need to pay for the shipping, then the Rate card system allows that functionality; you will need a field on your Account object that specifies the Name of the Rate Card to use, and you set that field on this section:

Finally we have the Service Type Options tab where you can disable or change the display name of each service type.

You will also notice that the fallback text is available for you to set, in case the carriers servers don't respond in time for giving an estimated date.

Click on Save and this part is now done.

Configuration Guest Profile

  1. Go to Setup > Profiles and select the Guest Profile, and click on Edit
  2. Add possibility to Delete the Cart object and click Save.

B2B Commerce Tracking

If you want to show the tracking information on your order detail page please follow these steps below:

  1. Add class 'MCB2BOrderService' to Guest/Community Profile
  2. Create new Text fields on Order Summary Object, e.g. Tracking Number (api name: Tracking_Number__c) and Tracking Stage (api name: Tracking_Stage__c)
  3. Go to Order Summary page, create new List View (e.g. Tracking List View)
    - Go to Experience Builder, choose Order Summary -> Order Summary List Page
    - Choose list component, set Filter Name as 'Tracking List View'
  4. Go to Experience Builder, choose Order Summary -> Order Summary Detail Page
  5. Add the following component to the page:
    Order Summary Tracking Details.
    Configuration
    - Tracking Number Field as Tracking_Number__c (from step #2)
    - Tracking Stage Field as Tracking_Stage__c (from step #2)
    - Show Tracking URL (Branding Tracking URL)
  6. Publish Changes
  7. Guest Community Profiles: add access to the fields you created earlier: Tracking_Number__c/Tracking_Stage__c

B2B Commerce Returns

If you want to show a return button on your order detail page please follow these steps below:

  1. Add class 'MCB2BOrderService' to Guest/Community Profile
  2. Create new Checkbox field on Order Summary Object, e.g. Show Return Button (api name: Show_Return_Button__c)
  3. Go to Order Summary page, create new List View (e.g. Tracking List View)
    - Go to Experience Builder, choose Order Summary -> Order Summary List Page
    - Choose list component, set Filter Name as 'Tracking List View'
  4. Go to Experience Builder, choose Order Summary -> Order Summary Detail Page
  5. Add the following components to page:
    Order Summary Create Return Shipment
    Configuration:
    - Show Return Button as Show_Return_Button__c (from step #3)
  6. Publish Changes
  7. Guest Community Profiles: add access to the fields you created earlier: Show_Return_Button__c

Next you need to create the Custom Address Source for a return shipment and also the related Process Builder or Flow to create the return label and another one to email the label to the user.

Custom Address Source

You need to create a Custom Address Source to map the values from your Order Summary into the carrier values. We have a guide on how the custom address source works here. We have also created a template of the custom address source that you can import. The link for the custom address source can be found here.

Once you have set up the Custom Address Source please copy the salesforce ID for it as it will be required in the next step.

Process Builder for Return Shipment Creation

Go to Setup > Process Builders and create a new Process Builder.

Under the object choose "Order Summary", and in the criteria select the field called Create Return Label.

Next in the immediate action select "Apex" and the Apex class "Create Shipment (Multi Carrier)". It sometimes times a while for the items to appear, so please be patient (it can take 3-4 minutes).

The customAddressId is the Salesforce ID of the Custom Address Source you created in the previous step.

The recordID is the Order Summary ID.

Make sure you save your Process Builder and you should now test that this works as expected.

To test please requests a return from the storefront order detail page. A new shipment should be created related to the Order Summary.

Please look at the APEX Logs to see if there are any errors. If you need assistance, please contact us.

Process Builder for Emailing the Label

Once the shipment has crated successfully, we want to send the email to the client. We do this using a process builder/flow. We will show you using the process builder.

Create a new Process Builder and select the Shipment object, and choose "Only when a Record is Created".

Under the criteria, make sure you set the filter to look for shipments that are of type Return.

Next set the process to run on a schedule, 0 hours after creation. We do this so that the shipment creation has time to save the labels to the object.

Now you can set extra values such as a send to email (otherwise we will use the recipient email address on the shipment object), and you can also set an email template to use, and you can set the emailTemplateID section. To use this email template ID make sure that the template is built with merge fields from the Shipment object.

Don't forget to save your process builder and to active it. If you need assistance, please contact us.

B2B Commerce Classic (CloudCraze)

Still using classic B2B Commerce? The guide for this is available here.
Back to Top