Visit Main Site
Join Partner Program
Login
     
Introduction
Authentication
Documentation
Category
GET
POST
PUT
DELETE
Products
GET
POST
PUT
DELETE
Carts
GET
POST
PATCH
DELETE
Variations
GET
POST
PUT
DELETE
Currency
GET
POST
PUT
DELETE
Tax
Tax Profile
GET
POST
PUT
DELETE
Tax Rule
GET
POST
PUT
DELETE
Tax Code
GET
POST
PUT
DELETE
Tax Zone
GET
POST
PUT
DELETE
Discount
GET
POST
PUT
DELETE
Shipping
Shipping Profile
GET
POST
PUT
DELETE
Shipping Rate
GET
POST
PUT
DELETE
Shipping Rules
GET
POST
PUT
DELETE
Customer
GET
POST
PUT
DELETE
Orders
GET
POST
PATCH
Blog
GET
POST
PUT
DELETE
Settings
GET
» Shipping Rule POST API Documentation

Creating a New Shipping Rule

Endpoint: POST /admin/shipping_rules

Purpose

This endpoint allows an admin to create a new shipping rule that binds a shipping policy, shipping class, and applicable zones. Shipping rules define how different policies apply across regions and shipping classes, enabling flexible delivery pricing and logic across the platform.

Path Parameters

No path parameters for this endpoint.

Query Parameters

No query parameters for this endpoint.

Use Case

An admin creates a shipping rule to associate a policy with the shipping class for global zones. This helps define granular control over shipping logic per region, carrier type, or delivery service level.

Request Body

Key Type Description
name String Name of the shipping rule.
profile_id String ID of the associated shipping profile.
shipping_class String ID of the related shipping class.
shipping_policy String ID of the shipping policy applied to this rule.
zones Array of Objects List of zone objects that this rule applies to (each with an id).
description String Description of the shipping rule.
Json
{
  "shipping_rule": {
    "name": "SHIPPING_RULE_NAME",
    "profile_id": "SHIPPING_PROFILE_ID",
    "shipping_class": "SHIPPING_CLASS_ID",
    "shipping_policy": "SHIPPING_POLICY_ID",
    "zones": [
      {
        "id": ZONE_ID_1
      },
      {
        "id": ZONE_ID_2
      }
    ],
    "description": "SHIPPING_RULE_DESCRIPTION"
  }
}

Response

Returns the full shipping rule object including the assigned ID, shipping policy and class info, zone details, description, and timestamps. This confirms the rule was successfully created and provides the data needed to review or display the rule setup.

POST
https://{your_site_domain}/api/v4/admin/shipping_rules
Try It Out
Json
{
  "shipping_rule": {
    "id": SHIPPING_RULE_ID,
    "name": "SHIPPING_RULE_NAME",
    "shipping_policy": {
      "id": SHIPPING_POLICY_ID,
      "name": "SHIPPING_POLICY_NAME"
    },
    "shipping_class": {
      "id": SHIPPING_CLASS_ID,
      "name": "SHIPPING_CLASS_NAME"
    },
    "zones": [
      {
        "id": ZONE_ID_1,
        "name": "ZONE_NAME_1"
      },
      {
        "id": ZONE_ID_2,
        "name": "ZONE_NAME_2"
      }
    ],
    "description": "SHIPPING_RULE_DESCRIPTION",
    "created_at": "YYYY-MM-DDTHH:MM:SS",
    "updated_at": "YYYY-MM-DDTHH:MM:SS"
  }
}
Terms and Conditions
Privacy Policy

© 2024 WebCommander | All Rights Reserved

contact@webcommander.com
1300 797 571

WebCommander
About Us
Features
Pricing
Compare
Partners
Contact Us
Resource
Find a Partner
Help Centre
Community
Blog
Solutions
Inventory Management
Omnichannel Sales
Ecommerce Automation
B2B Ecommerce
Headless Commerce
Website Design and Performance