Skip to main content

Retail: Shipping Fees

Connect your E-Commerce / Marketplace to GoRules and modify shipping fees

Background

Shipping fees are one of the most important components in the retail industry, directly impacting customer satisfaction and a company's bottom line. They are a crucial factor in the online shopping experience and proper calculation of shipping fees is essential for success in the retail industry.

Business Rule Management Systems (BRMS) have become an increasingly popular solution for automating and managing the complex process of calculating shipping fees. BRMS provide a flexible and scalable platform for retail companies to define, manage, and implement shipping fee rules based on their specific requirements. With BRMS, retail companies can set rules for different shipping methods, such as ground shipping, expedited shipping, or international shipping, and also apply specific fees based on the weight, volume, or destination of the package.

By the end of this tutorial, you will have a clear understanding of how GoRules can be used to manage shipping fees in retail businesses. You will learn about the key features and capabilities of GoRules, as well as how to implement shipping fee rules and make updates to them as needed.

Designing a decision

By using a rules engine, you can apply a set of predefined rules to the available information and automate the decision-making process. This can help ensure that the shipping fees are calculated accurately and efficiently.

For example, we can calculate shipping fees based on:

  • cart data (totals, number of items, weight,...)
  • customer data (geolocation, tier, overall spend,...)
  • order history

And a shopping cart simple model can look like:

{
"cart": {
"total": 800
},
"customer": {
"country": "US",
"tier": "gold"
}
}

We aim to create a single decision table looking at different parameters and create a output that can either return a ** percentage fee** or a flat fee.

To begin, set up a project and create a blank decision file.

For additional information, refer to the Project Authoring and Documents.

Connecting the graph

In the decision editor:

  1. access the editing mode by clicking on Edit Graph.
  2. add input and output components by dragging and dropping them into the graph.
  3. add a decision table, and rename it to Shipping Fees
  4. Connect the input component to a shipping fees decision table, now connect decision table to an output. To do this, hover over the output connector on the right side of the node, click and hold your mouse, and drag the connection to the input connector on the left side of the target component.
  5. Once all nodes have been connected, as shown in the example image, confirm your changes by clicking on Confirm.

Shipping Fees Decision Graph

Next, open decision table and modify the content by clicking the Open button on the node.

As we will monitor 3 parameters (cart total, customer country, and customer tier) create three input columns:

LabelField
Cart totalcart.total
Customer countrycustomer.country
Customer tiercustomer.tier

Based on our goal to return either flat or percentage fee, we will need to create two output columns.

LabelField
Fees Flat ($)fees.flat
Fees Percentagefees.percentage

Fill the values as shown in the image below:

Shipping Fees Decision Table

Description of the rows is as follows:

  1. if cart total is greater than 1000 and shipping country is United States and customer tier is gold, fee will be 2% of the total cart.
  2. if cart total is greater than 1000 and shipping country is United States, independent of the customer tier, fee will be 3% of the total cart.
  3. if cart total is less or equals 1000 and shipping country is United States, independent of the customer tier, fee will be flat $25.
  4. If cart total is greater than 1000 and shipping country is Canada or Mexico, fee will be 5% of the total cart.
  5. ...

Simulate

Access the simulator by clicking the Simulator button. Within the panel, activate the simulation by clicking the ** Simulate** button and observe the result.

To simulate different responses, we will add data to the request. Copy and paste the JSON model into the simulator and press Simulate.

Fintech Simulator Simple

Request:

{
"cart": {
"total": 800
},
"customer": {
"country": "US",
"tier": "gold"
}
}

The result should indicate that fee is $25 flat.

{
"performance": "67.904µs",
"result": {
"fees": {
"flat": 25
}
}
}

You can now modify the data and test with different request:

{
"cart": {
"total": 2000
},
"customer": {
"country": "GB"
}
}

In this case the result is 15% fee.

{
"performance": "75.055µs",
"result": {
"fees": {
"percent": 15
}
}
}

Congratulations, you can now start integrating your Retail order system directly with GoRules engine. To learn how to do it, please visit Evaluation API.