shipcloud / shipcloud-for-woocommerce

shipcloud for WooCommerce
GNU General Public License v3.0
6 stars 0 forks source link

Add shipment description #70

Closed andrecedik closed 7 years ago

andrecedik commented 7 years ago

This is a follow up to ticket #36:

Admins currently can add a package description when creating a shipping label. In some cases, a description at the shipment object is needed.

From our JSON-schema:

text that describes the contents of the shipment. This parameter is mandatory if you're using UPS and the following conditions are true: from and to countries are not the same; from and/or to countries are not in the EU; from and to countries are in the EU and the shipments service is not standard

It is probably best to simply display another input field named shipment description where users can input their text. You could use a tooltip or something similar to display the conditions when this is needed.

ScreamingDev commented 7 years ago

Another one for @andrecedik

Which is already solved but just to be sure again :) As you see the end-customer can add a note to his order.

screen-170502-0181c

Shall we use this predefined WooCommerce field? If so, then I can say that we already implemented it this way.

andrecedik commented 7 years ago

Hmm, I don't think this solves the problem. There are 2 different use cases where we need a description. For both, the admin should specify it since only she/he knows what's will be send to the customer.

There is the shipment description which gives an overall description and can be used e.g. for a basic customs declaration. This is why it's mandatory for sending goods from one country to another (see this description above).

example:

{
  "to": {
    "company": "Receiver Inc.",
    "first_name": "Max",
    "last_name": "Mustermann",
    "street": "Beispielstrasse",
    "street_no": "42",
    "city": "Hamburg",
    "zip_code": "22100",
    "country": "DE"
  },
  "package": {
    "weight": 1.5,
    "length": 20,
    "width": 20,
    "height": 20,
  },
  "description": "promotional items",
  "carrier": "dhl",
  "service": "standard",
  "create_shipping_label": true
}

On the other hand there is the package description which describes the contents of a single package. As we state in our documentation:

This parameter is mandatory if you're using UPS with service returns or DHL with service express

example:

"package": {
  "weight": 1.5,
  "length": 20,
  "width": 20,
  "height": 20,
  "description": "industrial grade thermometers containing mercury"
}
ScreamingDev commented 7 years ago

Not sure if I got it correct then. How about a call once a week or so?

I would love to because in that way maybe most tickets might already gone. I like asking things directly because I think I solved it but if not then this will become some looong message board. Please have a look at this:

screen-170505-01064

The admin can already add a description and this will also be forwarded to the API. Yesterday or so I removed the automatism to use the note that the customer entered. So still the admin can do it, the API will get it. Big question about the little issue: Does this solve it? :)

andrecedik commented 7 years ago

How would a call to the api look like using the description field? The thing is, there are 2 different description fields that can both be used at the same time. As shown in the above examples there's the shipment description and the package description.

You could e.g. have a shipment that would look like this:

{
  "to": {
    "company": "Receiver Inc.",
    "first_name": "Max",
    "last_name": "Mustermann",
    "street": "Beispielstrasse",
    "street_no": "42",
    "city": "Hamburg",
    "zip_code": "22100",
    "country": "DE"
  },
  "package": {
    "weight": 1.5,
    "length": 20,
    "width": 20,
    "height": 20,
    "description": "industrial grade thermometers containing mercury"
  },
  "description": "promotional items",
  "carrier": "dhl",
  "service": "standard",
  "create_shipping_label": true
}

Although this case is doesn't happen too often there need to be 2 different description fields for the user to be able to fill them with the respective data.

mahype commented 7 years ago

Looks fine for me. @andrecedik Have you checked this?

andrecedik commented 7 years ago

Looks good to me. The label might be a little misleading (would have used something like "shipment description / Sendungsbeschreibung").

andrecedik commented 7 years ago

Ok, since I was able to create a shipping label now I could take a look at the data that was transmitted. Unfortunately I the shipment description wasn't part of it.

order_shipment_description
{
  "carrier": "dhl",
  "service": "standard",
  "from": [],
  "to": {
    "company": "company",
    "first_name": "Andr\u00e9",
    "last_name": "Cedik",
    "care_of": "care of for ever",
    "street": "Alter Teichweg",
    "street_nr": "29",
    "postcode": "22081",
    "city": "Hamburg",
    "state": "state",
    "country": "DE",
    "street_no": "29",
    "zip_code": "22081"
  },
  "package": {
    "width": "20",
    "height": "20",
    "length": "20",
    "weight": "2"
  },
  "create_shipping_label": true,
  "notification_email": "andre@shipcloud.io",
  "additional_services": [{
    "name": "advance_notice",
    "properties": {
      "email": "andre@shipcloud.io",
      "language": "DE"
    }
  }],
  "reference_number": "Bestellung 23"
}
ScreamingDev commented 7 years ago

Just fixed this. Found also the place where it shall occur:

screen-170512-01387

andrecedik commented 7 years ago

Awesome 🙌