Skip to main content

Force Custom Shipping Rate for an Order

As a developer working on a Kreezalid-based marketplace, you already know that the platform offers powerful shipping management capabilities. However, there are situations where you need to take control and set custom shipping rates for specific orders. In this guide, we'll delve into the details of using the Kreezalid Front API's "Force Custom Shipping Rate" endpoint to achieve this.

| For shipping methods management from the admin panel, see : Manage the delivery/shipping methods of your marketplace and Manage logistic categories for efficient delivery cost optimization

The "Force Custom Shipping Rate" Endpoint

The "Force Custom Shipping Rate" endpoint is your go-to tool for setting custom shipping rates for individual orders. It's designed to provide flexibility when dealing with unique shipping requirements that fall outside the realm of standard shipping methods. To utilize this endpoint effectively, you'll make a PATCH request to the following URL:

PATCH /front_api/v1/carts/{cart_url_key}/orders/{order_id}/force-custom-shipping-rate

Note on Custom Shipping Rates

When you force a custom shipping rate for an order, it remains static. In other words, it won't automatically update if the shipping method changes or new items are added to the order. Keep this in mind when deciding to apply custom rates.

Request Parameters

To set a custom shipping rate for an order, your API request should include the following parameters:

cart_url_key: This is a unique identifier for the shopping cart associated with the order. order_id: Specify the ID of the order for which you want to set a custom shipping rate. custom_shipping_rate: Define the custom shipping rate you wish to apply. This should be in numeric format, such as 12.34 for $12.34.

Here's an example of what your API request body might look like in JSON format:

{
"custom_shipping_rate": 12.34
}

Making the Request

As a developer, you're likely familiar with crafting HTTP requests. In this case, you'll make a PATCH request to the endpoint mentioned above. Ensure that you include the necessary request parameters to specify the custom shipping rate you want to set for the order.

Sample cURL Request

Here's an example of how to make a cURL request to the "Force Custom Shipping Rate" endpoint:

curl -X PATCH "https://marketplace-name.mykreezalid.com/front_api/v1/carts/{cart_url_key}/orders/{order_id}/force-custom-shipping-rate" -H "Content-Type: application/json" -d '{
"custom_shipping_rate": 12.34
}'

Handling the Response

Upon successfully making the request, you'll receive a response from the API indicating whether the custom shipping rate was applied to the order. Be sure to implement appropriate error handling and response parsing in your application to provide feedback to users or perform further actions.

Wrapping Up

Setting custom shipping rates for orders in your Kreezalid-based marketplace allows you to cater to unique customer needs. With the "Force Custom Shipping Rate" endpoint in the Kreezalid Front API, you have the flexibility to make this process seamless and tailored to your marketplace's requirements.

For more advanced API capabilities and documentation, refer to the Kreezalid API Documentation. Now, you can confidently manage custom shipping rates and enhance the shopping experience for your marketplace users. Happy coding!