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

feat(webshipper): support personal customs no in orders #2167

Merged
merged 2 commits into from
Sep 9, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 29 additions & 0 deletions packages/medusa-fulfillment-webshipper/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,3 +15,32 @@ A webhook listener is exposed at `/webshipper/shipments` to listen for shipment
coo_countries: [an array of countries in which a Certificate of Origin will be attached] (default: "all")
delete_on_cancel [determines whether Webshipper orders are deleted when a Medusa fulfillment is canceled] (default: false)
```

## Personal Customs Numbers

In countries like South Korea a personal customs number is required to clear customs. The Webshipper fulfillment plugin is able pass this information to Webshipper given that the number is stored in `order.shipping_address.metadata.personal_customs_no`.

### Modifications in checkout flow

To pass the information along you should dynamically show an input field to the customer when they are shopping from a region that requires a personal customs number, and make sure that the metadata field is set when updating the cart shipping address.

```js
const onUpdateAddress = async () => {
const address = {
first_name: "John",
last_name: "Johnson",
...,
metadata: {
personal_customs_no: "my-customs-number"
}
}

await medusaClient.carts
.update(cartId, {
shipping_address: address
})
.then(() => {
console.log("Good stuff - Webshipper will pass along the customs number")
})
}
```
Original file line number Diff line number Diff line change
Expand Up @@ -390,6 +390,8 @@ class WebshipperFulfillmentService extends FulfillmentService {
state: shipping_address.province,
phone: shipping_address.phone,
email: fromOrder.email,
personal_customs_no:
shipping_address.metadata?.personal_customs_no || null,
},
currency: fromOrder.currency_code.toUpperCase(),
},
Expand Down