Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Creating a package #13552

Open
atorresveiga opened this issue Aug 11, 2024 · 3 comments
Open

Creating a package #13552

atorresveiga opened this issue Aug 11, 2024 · 3 comments
Assignees
Labels
category: woo extensions Related to WC extensions or plugins. feature: shipping labels Related to creating, ordering, or printing shipping labels. type: task An internally driven task.

Comments

@atorresveiga
Copy link

This task is for adding network support for creating a new package using the latest plugin endpoint /wcshipping/v1/packages

Here is the endpoint's documentation
https://github.com/woocommerce/woocommerce-shipping/blob/trunk/docs/api/packages.md

@dangermattic
Copy link
Collaborator

dangermattic commented Aug 11, 2024

Thanks for reporting! 👍

@atorresveiga atorresveiga added type: task An internally driven task. category: woo extensions Related to WC extensions or plugins. feature: shipping labels Related to creating, ordering, or printing shipping labels. labels Aug 11, 2024
@Ecarrion Ecarrion self-assigned this Sep 26, 2024
@Ecarrion Ecarrion linked a pull request Oct 1, 2024 that will close this issue
4 tasks
@rachelmcr rachelmcr self-assigned this Nov 5, 2024
@rachelmcr
Copy link
Contributor

Note the request needs to be formatted a bit differently from the documentation:

POST /wcshipping/v1/packages
Content-Type: application/json

{
  "custom": [
    {
      "name": "Custom Package 1",
      "dimensions": "10 x 5 x 5",
      "boxWeight": 2
    }
  ],
  "predefined": {
    "UPS": ["Small Box", "Medium Box"],
    "FedEx": ["Envelope", "Pak"]
  }
}

@rachelmcr
Copy link
Contributor

You can use type with the strings box or envelope to specify the custom package type.

Other optional fields:

  • maxWeight
  • is_user_defined

Sample response:

{
    "data": {
        "predefined": {
            "usps": [
                "small_flat_box",
                "flat_envelope"
            ]
        },
        "custom": [
            {
                "id": "69d7052f934a7c218329de9c1abe3858",
                "name": "WCS&T Box",
                "dimensions": "15 x 15 x 15",
                "boxWeight": 0.25,
                "maxWeight": 0,
                "type": "box",
                "is_user_defined": true
            },
            {
                "id": "517116d2f2d929115f6e081ba780b84e",
                "name": "WCS&T Envelope",
                "dimensions": "30 x 10 x 1",
                "boxWeight": 0.1,
                "maxWeight": 0,
                "type": "envelope",
                "is_user_defined": true
            },
            {
                "id": "a344e7fa99e8bb88b15feb13141bf62c",
                "name": "WCShip Envelope",
                "dimensions": "100 x 10 x 1",
                "boxWeight": 0.25,
                "maxWeight": 0,
                "type": "envelope",
                "is_user_defined": true
            },
            {
                "id": "22025742fbfaf4d7e73da11caaff9a2a",
                "name": "WCShip Box 1",
                "dimensions": "10 x 10 x 10",
                "boxWeight": 1,
                "maxWeight": 0,
                "type": "box",
                "is_user_defined": true
            },
            {
                "id": "03230052003beda6558f9d7782b9d5e4",
                "name": "WCShip Envelope 2",
                "dimensions": "10 x 10 x 10",
                "boxWeight": 1,
                "maxWeight": 0,
                "type": "box",
                "is_user_defined": true
            },
            {
                "id": "dd58dcd5dc044b6c56540c557c231c4f",
                "name": "WCShip Envelope 3",
                "dimensions": "10 x 10 x 10",
                "boxWeight": 1,
                "maxWeight": 0,
                "type": "envelope",
                "is_user_defined": true
            }
        ]
    }
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
category: woo extensions Related to WC extensions or plugins. feature: shipping labels Related to creating, ordering, or printing shipping labels. type: task An internally driven task.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants