» 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

Use this function 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.

def admin_shipping_profiles_get_list_test():
    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)

Response

Upon successful execution, 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.

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
    )
)

Getting Specific Shipping Profiles

Functions: 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 product.

Use Case

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.

def admin_shipping_profiles_get_details_test():
    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.details(id=id)
        print(response)
    except WCException as ab:
        print(ab)
        print(ab.get_errors())
        print(ab.raw_response)

Response

Upon successful execution, 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.

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"
    )
)

Creating Specific Tax Profiles

Functions: 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
name
String
The unique name of the tax profiles.

Use Case

Use this function 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.

def admin_create_shipping_profiles_test():
    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)

Response

Upon successful execution, 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.

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"
    )
)

Updating Specific Shipping Profiles

Functions: 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 tax profiles.

Use Case

Use this function 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.

def admin_update_shipping_profiles_test():
    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)

Response

Upon successful execution, 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.

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"
    )
)

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 blog post to be deleted.

Use Case

Use this function 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.

def admin_shipping_profiles_delete_test():
    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)

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.