Visit Main Site
Join Partner Program
Login
     
Introduction
Installation
Python
Documentation
Category
Products
Carts
Variations
Currency
Tax
Tax Profile
Tax Rule
Tax Code
Tax Zone
Discount
Shipping
Shipping Profile
Shipping Rate
Shipping Rules
Customer
Orders
Blog
Settings
» Shipping Profile SDK Documentation

Getting All Shipping Profiles

Function: admin_shipping_profiles_get_list()

Purpose

The admin_shipping_profiles_get_list() function retrieves a list of all available shipping profiles. Each shipping profile defines shipping rules and preferences that dictate how orders are processed and delivered. This function provides a comprehensive overview of existing shipping profiles along with associated rules and policies.

Parameters

This function does not require any input parameters.

Use Case

This function can be used when you need to fetch and review all shipping profiles within the system. This is useful for managing shipping rules, auditing shipping settings, or displaying available shipping profiles in an administrative dashboard.

PYTHON
PHP
def admin_shipping_profiles_get_list():
    SDKConfig.PRINT_REQUEST_DATA = False
    SDKConfig.PRINT_RAW_RESPONSE = False

    webcommander_sdk: WebCommanderSDK = WebCommanderSDK().init_sdk(request_token_dto=CommonData.get_request_token_dto())

    try:
        response = webcommander_sdk.admin_shipping_profiles.list()
        print(response)
    except WCException as ab:
        print(ab)
        print(ab.get_errors())
        print(ab.raw_response)

    public function AdminShippingProfilesGetList()
    {
        try {
            $queryParams = [
                'my' => 'organised_events',
                'position' => 1,
                'rows' => 1,
            ];
            $response = $this->adminShippingProfilesService->readAllAdminShippingProfiles();
            echo '<pre>' . json_encode($response, JSON_PRETTY_PRINT) . '</pre>';
        } catch (Exception $e) {
            echo 'Error: ' . $e->getMessage();
        }
    }

Response

The function returns a ShippingProfilesListResponseDTO object. This object contains a list of ShippingProfileDTO items, each detailing a shipping profile’s id, name, rulePreference, description, associated shipping rules, and creation and update timestamps. If the request fails, an error message is returned.

PYTHON
PHP
ShippingProfilesListResponseDTO(
    shippingProfiles=[
        ShippingProfileDTO(
            id=PLACEHOLDER_ID,
            name="PLACEHOLDER_NAME",
            rulePreference="PLACEHOLDER_RULE_PREFERENCE",
            shippingRules=[
                ShippingRuleDTO(
                    id=PLACEHOLDER_RULE_ID,
                    name="PLACEHOLDER_RULE_NAME",
                    shippingPolicy=ShippingPolicyDTO(
                        id=PLACEHOLDER_POLICY_ID,
                        name="PLACEHOLDER_POLICY_NAME"
                    )
                )
            ],
            description="PLACEHOLDER_DESCRIPTION",
            createdAt="PLACEHOLDER_CREATED_AT",
            updatedAt="PLACEHOLDER_UPDATED_AT"
        ),
        ShippingProfileDTO(
            id=PLACEHOLDER_ID,
            name="PLACEHOLDER_NAME",
            rulePreference="PLACEHOLDER_RULE_PREFERENCE",
            shippingRules=[],
            description="PLACEHOLDER_DESCRIPTION",
            createdAt="PLACEHOLDER_CREATED_AT",
            updatedAt="PLACEHOLDER_UPDATED_AT"
        )
    ],
    pagination=PaginationDTO(
        records=PLACEHOLDER_RECORDS,
        limit=PLACEHOLDER_LIMIT,
        offset=PLACEHOLDER_OFFSET,
        nextPage=PLACEHOLDER_NEXT_PAGE,
        previousPage=PLACEHOLDER_PREVIOUS_PAGE
    )
)
{
  "shipping_profiles": [
    {
      "id": "ID",
      "name": "PROFILE_NAME",
      "rule_preference": "RULE_PREFERENCE",
      "shipping_rules": [],
      "description": "DESCRIPTION",
      "created_at": "CREATED_AT",
      "updated_at": "UPDATED_AT"
    },
    {
      "id": "ID",
      "name": "PROFILE_NAME",
      "rule_preference": "RULE_PREFERENCE",
      "shipping_rules": [],
      "description": "DESCRIPTION",
      "created_at": "CREATED_AT",
      "updated_at": "UPDATED_AT"
    },
    {
      "id": "ID",
      "name": "PROFILE_NAME",
      "rule_preference": "RULE_PREFERENCE",
      "shipping_rules": [
        {
          "id": "ID",
          "name": "RULE_NAME",
          "shipping_policy": {
            "id": "ID",
            "name": "POLICY_NAME"
          }
        },
        {
          "id": "ID",
          "name": "RULE_NAME",
          "shipping_policy": {
            "id": "ID",
            "name": "POLICY_NAME"
          }
        }
      ],
      "description": "DESCRIPTION",
      "created_at": "CREATED_AT",
      "updated_at": "UPDATED_AT"
    },
    {
      "id": "ID",
      "name": "PROFILE_NAME",
      "rule_preference": "RULE_PREFERENCE",
      "shipping_rules": [
        {
          "id": "ID",
          "name": "RULE_NAME",
          "shipping_policy": {
            "id": "ID",
            "name": "POLICY_NAME"
          }
        },
        {
          "id": "ID",
          "name": "RULE_NAME",
          "shipping_policy": {
            "id": "ID",
            "name": "POLICY_NAME"
          }
        }
      ],
      "description": "DESCRIPTION",
      "created_at": "CREATED_AT",
      "updated_at": "UPDATED_AT"
    },
    {
      "id": "ID",
      "name": "PROFILE_NAME",
      "rule_preference": "RULE_PREFERENCE",
      "shipping_rules": [],
      "description": "DESCRIPTION",
      "created_at": "CREATED_AT",
      "updated_at": "UPDATED_AT"
    },
    {
      "id": "ID",
      "name": "PROFILE_NAME",
      "rule_preference": "RULE_PREFERENCE",
      "shipping_rules": [],
      "description": "DESCRIPTION",
      "created_at": "CREATED_AT",
      "updated_at": "UPDATED_AT"
    },
    {
      "id": "ID",
      "name": "PROFILE_NAME",
      "rule_preference": "RULE_PREFERENCE",
      "shipping_rules": [],
      "description": "DESCRIPTION",
      "created_at": "CREATED_AT",
      "updated_at": "UPDATED_AT"
    },
    {
      "id": "ID",
      "name": "PROFILE_NAME",
      "rule_preference": "RULE_PREFERENCE",
      "shipping_rules": [],
      "description": "DESCRIPTION",
      "created_at": "CREATED_AT",
      "updated_at": "UPDATED_AT"
    },
    {
      "id": "ID",
      "name": "PROFILE_NAME",
      "rule_preference": "RULE_PREFERENCE",
      "shipping_rules": [
        {
          "id": "ID",
          "name": "RULE_NAME",
          "shipping_policy": {
            "id": "ID",
            "name": "POLICY_NAME"
          }
        }
      ],
      "description": "DESCRIPTION",
      "created_at": "CREATED_AT",
      "updated_at": "UPDATED_AT"
    },
    {
      "id": "ID",
      "name": "PROFILE_NAME",
      "rule_preference": "RULE_PREFERENCE",
      "shipping_rules": [
        {
          "id": "ID",
          "name": "RULE_NAME",
          "shipping_policy": {
            "id": "ID",
            "name": "POLICY_NAME"
          }
        }
      ],
      "description": "DESCRIPTION",
      "created_at": "CREATED_AT",
      "updated_at": "UPDATED_AT"
    },
    {
      "id": "ID",
      "name": "PROFILE_NAME",
      "rule_preference": "RULE_PREFERENCE",
      "shipping_rules": [],
      "description": "DESCRIPTION",
      "created_at": "CREATED_AT",
      "updated_at": "UPDATED_AT"
    }
  ],
  "pagination": {
    "records": "TOTAL_RECORDS",
    "limit": "LIMIT",
    "offset": "OFFSET",
    "previous_page": "PREVIOUS_PAGE",
    "next_page": "NEXT_PAGE"
  }
}

Getting Specific Shipping Profiles

Function: admin_shipping_profiles_get_details() 

Purpose

The admin_shipping_profiles_get_details() function retrieves detailed information about a specific shipping profile. This includes the profile's name, rule preferences, associated shipping rules, and other metadata. It is useful for examining and managing the configuration of a particular shipping profile.

Parameters

Parameter
Type
Description
id
String
The unique identifier of the shipping profile.

Use Case

The function retrieves detailed information about a specific shipping profile. This includes the profile's name, rule preferences, associated shipping rules, and other metadata. It is useful for examining and managing the configuration of a particular shipping profile.

PYTHON
PHP
def admin_shipping_profiles_get_details():
    SDKConfig.PRINT_REQUEST_DATA = False
    SDKConfig.PRINT_RAW_RESPONSE = False

    webcommander_sdk: WebCommanderSDK = WebCommanderSDK().init_sdk(request_token_dto=CommonData.get_request_token_dto())

    try:
        id = 'SHIPPING_PROFILE_ID'
        response = webcommander_sdk.admin_shipping_profiles.details(id=id)
        print(response)
    except WCException as ab:
        print(ab)
        print(ab.get_errors())
        print(ab.raw_response)
public function AdminShippingProfilesGetDetails()
    {
        try {
            $id = 'SHIPPING_PROFILE_ID';
            $response = $this->adminShippingProfilesService->readDetailsAdminShippingProfiles($id);
            echo '<pre>' . json_encode($response, JSON_PRETTY_PRINT) . '</pre>';
        } catch (Exception $e) {
            echo 'Error: ' . $e->getMessage();
        }
    }

Response

The function returns a ShippingProfilesDetailsResponseDTO object. This object contains a ShippingProfileDTO with detailed information, including the id, name, rulePreference, associated shippingRules, description, and timestamps for creation and last update. If the request fails, an error message is returned.

PYTHON
PHP
ShippingProfilesDetailsResponseDTO(
    shippingProfile=ShippingProfileDTO(
        id=PLACEHOLDER_ID,
        name="PLACEHOLDER_NAME",
        rulePreference="PLACEHOLDER_RULE_PREFERENCE",
        shippingRules=[
            ShippingRuleDTO(
                id=PLACEHOLDER_RULE_ID,
                name="PLACEHOLDER_RULE_NAME",
                shippingPolicy=ShippingPolicyDTO(
                    id=PLACEHOLDER_POLICY_ID,
                    name="PLACEHOLDER_POLICY_NAME"
                )
            )
        ],
        description="PLACEHOLDER_DESCRIPTION",
        createdAt="PLACEHOLDER_CREATED_AT",
        updatedAt="PLACEHOLDER_UPDATED_AT"
    )
)
{
  "shipping_profile": {
    "id": "ID",
    "name": "PROFILE_NAME",
    "rule_preference": "RULE_PREFERENCE",
    "shipping_rules": [
      {
        "id": "RULE_ID",
        "name": "RULE_NAME",
        "shipping_policy": {
          "id": "POLICY_ID",
          "name": "POLICY_NAME"
        }
      }
    ],
    "description": "DESCRIPTION",
    "created_at": "CREATED_AT",
    "updated_at": "UPDATED_AT"
  }
}

Creating Specific Shipping Profiles

Function: admin_create_shipping_profiles() 

Purpose

The admin_create_shipping_profiles() function allows you to create a new shipping profile. This profile includes details such as the profile name, rule preferences, description, and associated profile type settings. It is used to define shipping policies and how shipping rules should be applied.

Parameters

Parameter Type Description
default Boolean Indicates if the profile is the default one.
name String The name of the shipping profile.
rulePreference String Defines which rule takes precedence for shipping logic.
description String A description of the shipping profile.

Use Case

This function can be used when you need to add a new shipping profile to the system. This is useful when onboarding new shipping methods, defining specific rules for shipping calculations, or customizing how shipping costs are handled within the platform.

PYTHON
PHP
def admin_create_shipping_profiles():
    SDKConfig.PRINT_REQUEST_DATA = False
    SDKConfig.PRINT_RAW_RESPONSE = False

    webcommander_sdk: WebCommanderSDK = WebCommanderSDK().init_sdk(request_token_dto=CommonData.get_request_token_dto())

    try:
        request_data = ShippingProfilesRequestDTO(
            shippingProfile=ShippingProfileRequestDataDTO(
                default=False,
                profileType=ProfileTypeDTO(
                    type="PLACEHOLDER_TYPE",
                    select="PLACEHOLDER_SELECT",
                    rule="PLACEHOLDER_RULE"
                ),
                name="PLACEHOLDER_NAME",
                rulePreference="PLACEHOLDER_RULE_PREFERENCE",
                description="PLACEHOLDER_DESCRIPTION"
            )
        )
        response = webcommander_sdk.admin_shipping_profiles.create_shipping_profiles(request_data=request_data)
        print(response)

    except WCException as ab:
        print(ab)
        print(ab.get_errors())
        print(ab.raw_response)
public function adminCreateShippingProfiles()
{
    $params = [
        "shipping_profile" => [
            "default" => false,  
            "profile_type" => [
                "type" => "CREATE",    
                "select" => "MODULE_NAME",  // Placeholder for select
                "rule" => "RULE_NAME"     // Placeholder for rule
            ],
            "name" => "Admin's Nges1",  
            "rule_preference" => "LOWEST_SHIPPING_COST_RULE",  
            "description" => "DESCRIPTION"  // Placeholder for description
        ]
    ];
    
    try {
        $response = $this->adminShippingProfilesService->createAdminShippingProfiles($params);
        echo '<pre>' . json_encode($response, JSON_PRETTY_PRINT) . '</pre>';
    } catch (Exception $e) {
        echo 'Error: ' . $e->getMessage();
    }
}

Response

The function returns a ShippingProfilesDetailsResponseDTO object. This object contains a ShippingProfileDTO with information about the newly created shipping profile, including the id, name, rulePreference, description, and timestamps for creation and last update. If the request fails, an error message is returned.

PYTHON
PHP
ShippingProfilesDetailsResponseDTO(
    shippingProfile=ShippingProfileDTO(
        id=PLACEHOLDER_ID,
        name="PLACEHOLDER_NAME",
        rulePreference="PLACEHOLDER_RULE_PREFERENCE",
        shippingRules=[
            ShippingRuleDTO(
                id=PLACEHOLDER_RULE_ID,
                name="PLACEHOLDER_RULE_NAME",
                shippingPolicy=ShippingPolicyDTO(
                    id=PLACEHOLDER_POLICY_ID,
                    name="PLACEHOLDER_POLICY_NAME"
                )
            )
        ],
        description="PLACEHOLDER_DESCRIPTION",
        createdAt="PLACEHOLDER_CREATED_AT",
        updatedAt="PLACEHOLDER_UPDATED_AT"
    )
)
{
  "shipping_profile": {
    "id": "ID",
    "name": "PROFILE_NAME",
    "rule_preference": "RULE_PREFERENCE",
    "shipping_rules": [],
    "description": "DESCRIPTION",
    "created_at": "CREATED_AT",
    "updated_at": "UPDATED_AT"
  }
}

Updating Specific Shipping Profiles

Function: admin_update_shipping_profiles() 

Purpose

The admin_update_shipping_profiles() function allows you to update an existing shipping profile by modifying its name, rule preference, description, and other details. This ensures that shipping profiles remain accurate and up-to-date as business needs evolve.

Parameters

Parameter Type Description
id String The unique identifier of the shipping profile to be updated.
name String Updated name of the shipping profile.
rulePreference String Updated rule preference that defines which shipping rule takes priority.
description String Updated description of the shipping profile.

Use Case

This function can be used when you need to change the details of a specific shipping profile. This is useful for scenarios where shipping rules, profile names, or descriptions must be updated to reflect new policies or changes in shipping preferences.

PYTHON
PHP
def admin_update_shipping_profiles():
    SDKConfig.PRINT_REQUEST_DATA = False
    SDKConfig.PRINT_RAW_RESPONSE = False

    webcommander_sdk: WebCommanderSDK = WebCommanderSDK().init_sdk(request_token_dto=CommonData.get_request_token_dto())

    try:
        request_data = ShippingProfilesRequestDTO(
            shippingProfile=ShippingProfileRequestDataDTO(
                name="PLACEHOLDER_NAME",
                rulePreference="PLACEHOLDER_RULE_PREFERENCE",
                description="PLACEHOLDER_DESCRIPTION"
            )
        )
        id = "PLACEHOLDER_ID"
        response = webcommander_sdk.admin_shipping_profiles.update_shipping_profiles(id=id, request_data=request_data)
        print(response)

    except WCException as ab:
        print(ab)
        print(ab.get_errors())
        print(ab.raw_response)
public function adminUpdateShippingProfiles()
{
    $params = [
        "shipping_profile" => [
            "default" => false,
            "profile_type" => [
                "type" => "CREATE",  // No change to type
                "select" => "MODULE_NAME",  // Placeholder for select
                "rule" => "RULE_NAME"     // Placeholder for rule
            ],
            "name" => "PROFILE_NAME",  // Replace with value
            "rule_preference" => "LOWEST_SHIPPING_COST_RULE",  // Static value, no change
            "description" => "DESCRIPTION"  // Placeholder for description
        ]
    ];
    $id = "ID_VALUE";  // Placeholder for ID value

    try {
        $response = $this->adminShippingProfilesService->updateAdminShippingProfiles($id, $params);
        echo '<pre>' . json_encode($response, JSON_PRETTY_PRINT) . '</pre>';
    } catch (Exception $e) {
        echo 'Error: ' . $e->getMessage();
    }
}

Response

The function returns a ShippingProfilesDetailsResponseDTO object. This object contains the updated ShippingProfileDTO, including the modified profile information and associated shipping rules. If the request fails, an error message is returned.

PYTHON
PHP
ShippingProfilesDetailsResponseDTO(
    shippingProfile=ShippingProfileDTO(
        id=PLACEHOLDER_ID,
        name="PLACEHOLDER_NAME",
        rulePreference="PLACEHOLDER_RULE_PREFERENCE",
        shippingRules=[
            ShippingRuleDTO(
                id=PLACEHOLDER_RULE_ID,
                name="PLACEHOLDER_RULE_NAME",
                shippingPolicy=ShippingPolicyDTO(
                    id=PLACEHOLDER_POLICY_ID,
                    name="PLACEHOLDER_POLICY_NAME"
                )
            )
        ],
        description="PLACEHOLDER_DESCRIPTION",
        createdAt="PLACEHOLDER_CREATED_AT",
        updatedAt="PLACEHOLDER_UPDATED_AT"
    )
)
{
  "shipping_profile": {
    "id": "ID",
    "name": "PROFILE_NAME",
    "rule_preference": "RULE_PREFERENCE",
    "shipping_rules": [],
    "description": "DESCRIPTION",
    "created_at": "CREATED_AT",
    "updated_at": "UPDATED_AT"
  }
}

Deleting a Shipping Profiles

Function: admin_shipping_profiles_delete()

Purpose

The admin_shipping_profiles_delete() function allows you to delete a specific shipping profile by providing its unique identifier. This is useful for removing outdated or unnecessary shipping profiles from the system.

Parameters

ParameterTypeDescription
idStringThe unique identifier of the shipping profile to be deleted.

Use Case

This function can be used when you need to permanently delete a shipping profile that is no longer required. For example, if a shipping profile is deprecated or incorrectly created, this function facilitates its removal to maintain accurate shipping configurations.

PYTHON
PHP
def admin_shipping_profiles_delete():
    SDKConfig.PRINT_REQUEST_DATA = False
    SDKConfig.PRINT_RAW_RESPONSE = False

    webcommander_sdk: WebCommanderSDK = WebCommanderSDK().init_sdk(request_token_dto=CommonData.get_request_token_dto())

    try:
        id = "PLACEHOLDER_ID"
        response = webcommander_sdk.admin_shipping_profiles.shipping_profiles_delete(id=id)
        print(response)
    except WCException as ab:
        print(ab)
        print(ab.get_errors())
        print(ab.raw_response)
public function adminShippingProfilesDelete()
    {

        $id="PROFILE_ID";
        try {
            $response = $this->adminShippingProfilesService->deleteAdminShippingProfiles($id);
            echo '<pre>' . json_encode($response, JSON_PRETTY_PRINT) . '</pre>';
        } catch (Exception $e) {
            echo 'Error: ' . $e->getMessage();
        }
    }


}

Response

Upon successful execution, the function returns a success message indicating that the shipping profile has been deleted. If the request fails, an error message is returned.

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