1. Home
  2. Ecommerce Rest Api
  3. WordPress WooCommerce
  4. Shipping Methods

Shipping Methods

Prerequisites

  • WooCommerce API Keys: You need Consumer Key and Consumer Secret.
  • Base URL: Replace https://yourstore.com with your actual WooCommerce store URL.
  • Authorization: Basic Auth with your Consumer Key and Consumer Secret.

Authorization Setup in Postman

  1. Go to the Authorization tab.
  2. Select Type: Basic Auth.
  3. Username: Enter your Consumer Key.
  4. Password: Enter your Consumer Secret.

1. List Shipping Methods for a Zone

  • URL: https://yourstore.com/wp-json/wc/v3/shipping/zones/{zone_id}/methods
  • Method: GET
  • Headers:
    • Authorization: Basic Auth
  • Replace {zone_id} with the actual shipping zone ID.

Example in Postman:

  1. Set method to GET.
  2. Enter URL: https://yourstore.com/wp-json/wc/v3/shipping/zones/{zone_id}/methods
  3. Go to the Authorization tab and set Type to Basic Auth.
  4. Enter Consumer Key and Consumer Secret.
  5. Send the request.

2. Retrieve a Shipping Method

  • URL: https://yourstore.com/wp-json/wc/v3/shipping/zones/{zone_id}/methods/{id}
  • Method: GET
  • Headers:
    • Authorization: Basic Auth
  • Replace {zone_id} with the actual shipping zone ID and {id} with the actual shipping method ID.

Example in Postman:

  1. Set method to GET.
  2. Enter URL: https://yourstore.com/wp-json/wc/v3/shipping/zones/{zone_id}/methods/{id}
  3. Go to the Authorization tab and set Type to Basic Auth.
  4. Enter Consumer Key and Consumer Secret.
  5. Send the request.

3. Create a Shipping Method

  • URL: https://yourstore.com/wp-json/wc/v3/shipping/zones/{zone_id}/methods
  • Method: POST
  • Headers:
    • Authorization: Basic Auth
  • Body: JSON with shipping method data.
  • Replace {zone_id} with the actual shipping zone ID.

Example JSON Body:

{
  "method_id": "flat_rate",
  "settings": {
    "title": "Flat Rate",
    "cost": "10.00"
  }
}

Example in Postman:

  1. Set method to POST.
  2. Enter URL: https://yourstore.com/wp-json/wc/v3/shipping/zones/{zone_id}/methods
  3. Go to the Authorization tab and set Type to Basic Auth.
  4. Enter Consumer Key and Consumer Secret.
  5. Go to the Body tab, select raw, choose JSON from the dropdown, and paste the example JSON body.
  6. Send the request.

4. Update a Shipping Method

  • URL: https://yourstore.com/wp-json/wc/v3/shipping/zones/{zone_id}/methods/{id}
  • Method: PUT
  • Headers:
    • Authorization: Basic Auth
  • Body: JSON with updated shipping method data.
  • Replace {zone_id} with the actual shipping zone ID and {id} with the actual shipping method ID.

Example JSON Body:

{
  "settings": {
    "title": "Updated Flat Rate",
    "cost": "15.00"
  }
}

Example in Postman:

  1. Set method to PUT.
  2. Enter URL: https://yourstore.com/wp-json/wc/v3/shipping/zones/{zone_id}/methods/{id}
  3. Go to the Authorization tab and set Type to Basic Auth.
  4. Enter Consumer Key and Consumer Secret.
  5. Go to the Body tab, select raw, choose JSON from the dropdown, and paste the example JSON body.
  6. Send the request.

5. Delete a Shipping Method

  • URL: https://yourstore.com/wp-json/wc/v3/shipping/zones/{zone_id}/methods/{id}
  • Method: DELETE
  • Headers:
    • Authorization: Basic Auth
  • Replace {zone_id} with the actual shipping zone ID and {id} with the actual shipping method ID.

Example in Postman:

  1. Set method to DELETE.
  2. Enter URL: https://yourstore.com/wp-json/wc/v3/shipping/zones/{zone_id}/methods/{id}
  3. Go to the Authorization tab and set Type to Basic Auth.
  4. Enter Consumer Key and Consumer Secret.
  5. Send the request.

By following these instructions, you can test each WooCommerce shipping methods endpoint in Postman. Each request should include the necessary Authorization header configured through Basic Auth with your Consumer Key and Consumer Secret.

How can we help?