Getting All Shipping Rates
Function: admin_shipping_rates_get_list()
Purpose
The admin_shipping_rates_get_list()
function retrieves a list of all available shipping rates. This provides an overview of the configured shipping rates, including their conditions, policies, and other relevant attributes.
Parameters
This function does not require any input parameters.
Use Case
This function can be used when you need to fetch and display all shipping rates. It is useful for managing and auditing shipping configurations, ensuring that the correct rates are applied, and identifying duplicate or outdated rates.
def admin_shipping_rates_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_rates.list()
print(response)
except WCException as ab:
print(ab)
print(ab.get_errors())
print(ab.raw_response)
Response
The function returns a ShippingRatesListResponseDTO
, which contains a list of ShippingRateDTO
objects. Each object includes detailed information about a shipping rate, such as its ID, name, policy type, conditions, and timestamps.
ShippingRatesListResponseDTO(
shippingRates=[
ShippingRateDTO(
id=PLACEHOLDER_ID,
name="PLACEHOLDER_NAME",
policyType="PLACEHOLDER_POLICY_TYPE",
additionalAmount=PLACEHOLDER_ADDITIONAL_AMOUNT,
additionalCost=PLACEHOLDER_ADDITIONAL_COST,
isCumulative=PLACEHOLDER_IS_CUMULATIVE,
includesTax=PLACEHOLDER_INCLUDES_TAX,
isAdditional=PLACEHOLDER_IS_ADDITIONAL,
conditions=[
ShippingConditionDTO(
id=PLACEHOLDER_CONDITION_ID,
fromAmount=PLACEHOLDER_FROM_AMOUNT,
toAmount=PLACEHOLDER_TO_AMOUNT,
packetWeight=PLACEHOLDER_PACKET_WEIGHT,
handlingCost=PLACEHOLDER_HANDLING_COST,
shippingCost=PLACEHOLDER_SHIPPING_COST,
shippingCostType="PLACEHOLDER_SHIPPING_COST_TYPE",
handlingCostType="PLACEHOLDER_HANDLING_COST_TYPE",
apiType="PLACEHOLDER_API_TYPE",
apiServiceType="PLACEHOLDER_API_SERVICE_TYPE",
extraCover=PLACEHOLDER_EXTRA_COVER,
packingAlgorithm="PLACEHOLDER_PACKING_ALGORITHM",
itemAttributes="PLACEHOLDER_ITEM_ATTRIBUTES",
shippingPolicy=[
ShippingPolicyDTO(
id=PLACEHOLDER_POLICY_ID
)
]
)
],
createdAt="PLACEHOLDER_CREATED_AT",
updatedAt="PLACEHOLDER_UPDATED_AT"
)
],
pagination=PaginationDTO(
records=PLACEHOLDER_TOTAL_RECORDS,
limit=PLACEHOLDER_LIMIT,
offset=PLACEHOLDER_OFFSET,
nextPage=PLACEHOLDER_NEXT_PAGE,
previousPage=PLACEHOLDER_PREVIOUS_PAGE
)
)
Getting Specific Shipping Rates
Function: admin_shipping_rates_get_details()
Purpose
The admin_shipping_rates_get_details()
function retrieves detailed information about a specific shipping rate using its unique identifier. This allows access to the shipping rate's configuration, including its conditions, policies, and metadata.
Parameters
Parameter | Type | Description |
---|---|---|
id | String | The unique identifier of the Shipping Rate. |
Use Case
This function can be used when you need to fetch the complete details of a particular shipping rate. It is helpful for inspecting, updating, or validating specific shipping rate configurations in the system.
def admin_shipping_rates_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 = 'PLACEHOLDER_ID'
response = webcommander_sdk.admin_shipping_rates.details(id=id)
print(response)
except WCException as ab:
print(ab)
print(ab.get_errors())
print(ab.raw_response)
Response
The function returns a ShippingRatesDetailsResponseDTO
object, which contains a ShippingRateDTO
representing the shipping rate's full details, including conditions, policy type, and timestamps.
ShippingRatesDetailsResponseDTO(
shippingRate=ShippingRateDTO(
id=PLACEHOLDER_ID,
name="PLACEHOLDER_NAME",
policyType="PLACEHOLDER_POLICY_TYPE",
additionalAmount=PLACEHOLDER_ADDITIONAL_AMOUNT,
additionalCost=PLACEHOLDER_ADDITIONAL_COST,
isCumulative=PLACEHOLDER_IS_CUMULATIVE,
includesTax=PLACEHOLDER_INCLUDES_TAX,
isAdditional=PLACEHOLDER_IS_ADDITIONAL,
conditions=[
ShippingConditionDTO(
id=PLACEHOLDER_CONDITION_ID,
fromAmount=PLACEHOLDER_FROM_AMOUNT,
toAmount=PLACEHOLDER_TO_AMOUNT,
packetWeight=PLACEHOLDER_PACKET_WEIGHT,
handlingCost=PLACEHOLDER_HANDLING_COST,
shippingCost=PLACEHOLDER_SHIPPING_COST,
shippingCostType="PLACEHOLDER_SHIPPING_COST_TYPE",
handlingCostType="PLACEHOLDER_HANDLING_COST_TYPE",
apiType="PLACEHOLDER_API_TYPE",
apiServiceType="PLACEHOLDER_API_SERVICE_TYPE",
extraCover=PLACEHOLDER_EXTRA_COVER,
packingAlgorithm="PLACEHOLDER_PACKING_ALGORITHM",
itemAttributes="PLACEHOLDER_ITEM_ATTRIBUTES",
shippingPolicy=[
ShippingPolicyDTO(
id=PLACEHOLDER_POLICY_ID
)
]
)
],
createdAt="PLACEHOLDER_CREATED_AT",
updatedAt="PLACEHOLDER_UPDATED_AT"
)
)
Creating Specific Shipping Rates
Function: admin_create_shipping_rates()
Purpose
The admin_create_shipping_rates()
function is used to create a new shipping rate in the system. This includes defining rate properties such as policy type, conditions, tax inclusion, and other parameters.
Parameters
Parameter | Type | Description |
---|---|---|
name | String | The name of the shipping rate. |
policyType | String | Type of policy this shipping rate applies to. |
additionalAmount | Float | Additional charge amount for this rate. |
additionalCost | Float | Additional base cost for the shipping rate. |
isCumulative | Boolean |
If True , this rate can be applied on top of others.
|
includesTax | Boolean | Indicates whether tax is included in the shipping cost. |
isAdditional | Boolean |
If True , this rate is considered an additional rate.
|
conditions | List[ShippingConditionDTO] | Conditions under which the shipping rate applies. |
Each ShippingConditionDTO
contains:
Field | Type | Description |
---|---|---|
id | String | ID of the shipping condition. |
fromAmount | Float | Minimum order amount for this rate to apply. |
toAmount | Float | Maximum order amount for this rate to apply. |
packetWeight | Float | Maximum weight for the shipping rate condition. |
handlingCost | Float | Cost of handling per order/item. |
shippingCost | Float | Main shipping cost. |
shippingCostType | String | Type of shipping cost. |
handlingCostType | String | Type of handling cost. |
apiType | String | API type (used for integrations with shipping carriers). |
apiServiceType | String | API service level type. |
extraCover | Boolean |
If True , includes extra cover insurance.
|
packingAlgorithm | String | The packing logic used. |
itemAttributes | String | Criteria based on item attributes. |
shippingPolicy | List[ShippingPolicyDTO] | List of policies tied to this shipping condition. |
Use Case
This function can be used when you need to add a new shipping rate to your system. It is helpful for setting up shipping costs, handling charges, and defining conditions based on shipping policies.
def admin_create_shipping_rates():
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 = ShippingRateRequestDTO(
shippingRate=ShippingRateDTO(
name="PLACEHOLDER_NAME",
policyType="PLACEHOLDER_POLICY_TYPE",
additionalAmount=PLACEHOLDER_ADDITIONAL_AMOUNT,
additionalCost=PLACEHOLDER_ADDITIONAL_COST,
isCumulative=PLACEHOLDER_IS_CUMULATIVE,
includesTax=PLACEHOLDER_INCLUDES_TAX,
isAdditional=PLACEHOLDER_IS_ADDITIONAL,
conditions=[
ShippingConditionDTO(
id=PLACEHOLDER_CONDITION_ID,
fromAmount=PLACEHOLDER_FROM_AMOUNT,
toAmount=PLACEHOLDER_TO_AMOUNT,
packetWeight=PLACEHOLDER_PACKET_WEIGHT,
handlingCost=PLACEHOLDER_HANDLING_COST,
shippingCost=PLACEHOLDER_SHIPPING_COST,
shippingCostType="PLACEHOLDER_SHIPPING_COST_TYPE",
handlingCostType="PLACEHOLDER_HANDLING_COST_TYPE",
apiType="PLACEHOLDER_API_TYPE",
apiServiceType="PLACEHOLDER_API_SERVICE_TYPE",
extraCover=PLACEHOLDER_EXTRA_COVER,
packingAlgorithm="PLACEHOLDER_PACKING_ALGORITHM",
itemAttributes="PLACEHOLDER_ITEM_ATTRIBUTES",
shippingPolicy=[
ShippingPolicyDTO(
id=PLACEHOLDER_POLICY_ID
)
]
)
]
)
)
response = webcommander_sdk.admin_shipping_rates.create_shipping_rates(request_data=request_data)
print(response)
except WCException as ab:
print(ab)
print(ab.get_errors())
print(ab.raw_response)
Response
The function returns a ShippingRatesDetailsResponseDTO
object containing the details of the newly created shipping rate, including its ID, name, policy type, and related conditions.
ShippingRatesDetailsResponseDTO(
shippingRate=ShippingRateDTO(
id=PLACEHOLDER_ID,
name="PLACEHOLDER_NAME",
policyType="PLACEHOLDER_POLICY_TYPE",
additionalAmount=PLACEHOLDER_ADDITIONAL_AMOUNT,
additionalCost=PLACEHOLDER_ADDITIONAL_COST,
isCumulative=PLACEHOLDER_IS_CUMULATIVE,
includesTax=PLACEHOLDER_INCLUDES_TAX,
isAdditional=PLACEHOLDER_IS_ADDITIONAL,
conditions=[
ShippingConditionDTO(
id=PLACEHOLDER_CONDITION_ID,
fromAmount=PLACEHOLDER_FROM_AMOUNT,
toAmount=PLACEHOLDER_TO_AMOUNT,
packetWeight=PLACEHOLDER_PACKET_WEIGHT,
handlingCost=PLACEHOLDER_HANDLING_COST,
shippingCost=PLACEHOLDER_SHIPPING_COST,
shippingCostType="PLACEHOLDER_SHIPPING_COST_TYPE",
handlingCostType="PLACEHOLDER_HANDLING_COST_TYPE",
apiType="PLACEHOLDER_API_TYPE",
apiServiceType="PLACEHOLDER_API_SERVICE_TYPE",
extraCover=PLACEHOLDER_EXTRA_COVER,
packingAlgorithm="PLACEHOLDER_PACKING_ALGORITHM",
itemAttributes="PLACEHOLDER_ITEM_ATTRIBUTES",
shippingPolicy=[
ShippingPolicyDTO(
id=PLACEHOLDER_POLICY_ID
)
]
)
],
createdAt="PLACEHOLDER_CREATED_AT",
updatedAt="PLACEHOLDER_UPDATED_AT"
)
)
Updating Specific Shipping Rates
Function: admin_update_shipping_rates()
Purpose
The admin_update_shipping_rates()
function is used to update an existing shipping rate in the system. This allows modifying shipping rate properties such as the name, policy type, conditions, tax settings, and other relevant attributes.
Parameters
Parameter | Type | Description |
---|---|---|
id | String | The unique ID of the shipping rate to update. |
name | String | Updated name of the shipping rate. |
policyType | String | Type of shipping policy. |
additionalAmount | Float | Additional charge applied beyond base amount. |
additionalCost | Float | Additional cost added to the shipping rate. |
isCumulative | Boolean | Whether this rate can be applied cumulatively with others. |
includesTax | Boolean | Specifies if the cost includes tax. |
isAdditional | Boolean | Flags if this rate is considered supplementary. |
conditions | List[ShippingConditionDTO] | Defines when and how the shipping rate applies. |
Each ShippingConditionDTO
may include:
Field | Type | Description |
---|---|---|
id | String | ID of the existing condition to update. |
fromAmount | Float | Lower threshold for order value. |
toAmount | Float | Upper threshold for order value. |
packetWeight | Float | Max packet weight applicable to this condition. |
handlingCost | Float | Cost of handling. |
shippingCost | Float | Primary shipping cost. |
shippingCostType | String | Shipping Cost Type. |
handlingCostType | String | Type of handling cost calculation. |
apiType | String | Integration type with third-party carriers. |
apiServiceType | String | Service level from external APIs. |
extraCover | Boolean |
If True , includes additional cover.
|
packingAlgorithm | String | Packing method. |
itemAttributes | String | Additional filtering based on item properties. |
shippingPolicy | List[ShippingPolicyDTO] | List of policy objects tied to this condition. |
Use Case
This function can be used when you need to change or correct an existing shipping rate. This is useful for adjusting shipping costs, updating conditions, or modifying policy types without creating a new shipping rate.
def admin_update_shipping_rates():
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 = ShippingRateRequestDTO(
shippingRate=ShippingRateDTO(
name="PLACEHOLDER_NAME",
policyType="PLACEHOLDER_POLICY_TYPE",
additionalAmount=PLACEHOLDER_ADDITIONAL_AMOUNT,
additionalCost=PLACEHOLDER_ADDITIONAL_COST,
isCumulative=PLACEHOLDER_IS_CUMULATIVE,
includesTax=PLACEHOLDER_INCLUDES_TAX,
isAdditional=PLACEHOLDER_IS_ADDITIONAL,
conditions=[
ShippingConditionDTO(
id=PLACEHOLDER_CONDITION_ID,
fromAmount=PLACEHOLDER_FROM_AMOUNT,
toAmount=PLACEHOLDER_TO_AMOUNT,
packetWeight=PLACEHOLDER_PACKET_WEIGHT,
handlingCost=PLACEHOLDER_HANDLING_COST,
shippingCost=PLACEHOLDER_SHIPPING_COST,
shippingCostType="PLACEHOLDER_SHIPPING_COST_TYPE",
handlingCostType="PLACEHOLDER_HANDLING_COST_TYPE",
apiType="PLACEHOLDER_API_TYPE",
apiServiceType="PLACEHOLDER_API_SERVICE_TYPE",
extraCover=PLACEHOLDER_EXTRA_COVER,
packingAlgorithm="PLACEHOLDER_PACKING_ALGORITHM",
itemAttributes="PLACEHOLDER_ITEM_ATTRIBUTES",
shippingPolicy=[
ShippingPolicyDTO(
id=PLACEHOLDER_POLICY_ID
)
]
)
]
)
)
id = "PLACEHOLDER_SHIPPING_RATE_ID"
response = webcommander_sdk.admin_shipping_rates.update_shipping_rates(id=id, request_data=request_data)
print(response)
except WCException as ab:
print(ab)
print(ab.get_errors())
print(ab.raw_response)
Response
The function returns a ShippingRatesDetailsResponseDTO
object containing the updated shipping rate details, including the new values for the shipping rate and its conditions.
ShippingRatesDetailsResponseDTO(
shippingRate=ShippingRateDTO(
id=PLACEHOLDER_SHIPPING_RATE_ID,
name="PLACEHOLDER_NAME",
policyType="PLACEHOLDER_POLICY_TYPE",
additionalAmount=PLACEHOLDER_ADDITIONAL_AMOUNT,
additionalCost=PLACEHOLDER_ADDITIONAL_COST,
isCumulative=PLACEHOLDER_IS_CUMULATIVE,
includesTax=PLACEHOLDER_INCLUDES_TAX,
isAdditional=PLACEHOLDER_IS_ADDITIONAL,
conditions=[
ShippingConditionDTO(
id=PLACEHOLDER_CONDITION_ID,
fromAmount=PLACEHOLDER_FROM_AMOUNT,
toAmount=PLACEHOLDER_TO_AMOUNT,
packetWeight=PLACEHOLDER_PACKET_WEIGHT,
handlingCost=PLACEHOLDER_HANDLING_COST,
shippingCost=PLACEHOLDER_SHIPPING_COST,
shippingCostType="PLACEHOLDER_SHIPPING_COST_TYPE",
handlingCostType="PLACEHOLDER_HANDLING_COST_TYPE",
apiType="PLACEHOLDER_API_TYPE",
apiServiceType="PLACEHOLDER_API_SERVICE_TYPE",
extraCover=PLACEHOLDER_EXTRA_COVER,
packingAlgorithm="PLACEHOLDER_PACKING_ALGORITHM",
itemAttributes="PLACEHOLDER_ITEM_ATTRIBUTES",
shippingPolicy=[
ShippingPolicyDTO(
id=PLACEHOLDER_POLICY_ID
)
]
)
],
createdAt="PLACEHOLDER_CREATED_AT",
updatedAt="PLACEHOLDER_UPDATED_AT"
)
)
Deleting a Shipping Rates
Function: admin_shipping_rates_delete()
Purpose
The admin_shipping_rates_delete()
function is used to delete an existing shipping rate by its unique identifier. This allows removing shipping rates that are no longer required or were created by mistake.
Parameters
Parameter | Type | Description |
---|---|---|
id | String | The unique identifier of the shipping rate to be deleted. |
Use Case
This function can be used when you need to permanently delete a shipping rate from the system. This is useful for cleaning up outdated, incorrect, or unnecessary shipping rates.
def admin_shipping_rates_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_SHIPPING_RATE_ID"
response = webcommander_sdk.admin_shipping_rates.shipping_rates_delete(id=id)
print(response)
except WCException as ab:
print(ab)
print(ab.get_errors())
print(ab.raw_response)
Response
The function returns a success message confirming that the shipping rate has been deleted.