Delivery 2.0

 

Delivery 2.0 was devised by Arcadier to offer Marketplaces the option to have flexible delivery/freight/shipping fees. Those fees would be dependant on the total price of a cart or the total weight of a cart. 

More details about the use of Delivery 2.0 on Arcadier's default marketplaces can be found here.

 

Delivery 2.0 and Arcadier API

As a developer, if you are building your own fulfillment flow and wish to use Delivery 2.0, these are the steps you need to follow:

1. Create different rates of your choice on the Admin portal as explained here.
2. Retrieve the rates in your app/plug-in using the Get Delivery 2.0 Shipping Rates API.
3. Use logic to detect the price/weight of a buyer's cart, and compare against the retrieved rates in #2.
4. Match and find the corresponding shipping fee.
5. Use Merchant - Edit Order Details or Admin - Edit Order Details to update the "Freight" field with that value.

From #2, this is what the API response might look like:

Get Delivery 2.0 Rates Example Response

The 3 most typically most important fields of this response are the

"ID" - The GUID of the delivery method

"Description" - The name of the delivery method

"Values" - Array of length 1, containing all the necessary information about the rates - in a single parsable string.

The first thing to do is obviously parsing CustomFields[0].Values, and extracting the rates out of it:

var obj = JSON.parse(price_dependant.CustomFields[0].Values); 

var rate = obj.Rates; 

Extra information such as the destination and origin countries and the minimum lead time can also be obtained by parsing this string.

Below is a JavaScript sample code to display the shipping fee, depending on the value of a variable, in console.log.

var variable = 15; //price or weight depending on how you created the Rates on the Admin portal


console.log("This item has a " + obj.CalculationType + " of " + variable + ".");

for (var i = 0; i < rate.length; i++) { 

  if (variable < rate[i].MaximumRange) { 

    console.log("Shipping Cost = $", rate[i].Cost);

    break;

  }

  if (rate[i].MaximumRange == "") { 

    console.log("Shipping Cost = $", rate[i].Cost);

  }

}