Skip to content

Latest commit

 

History

History
72 lines (56 loc) · 2.11 KB

File metadata and controls

72 lines (56 loc) · 2.11 KB

Vendure MyParcel Plugin

Vendure version

Plugin for sending placed orders to MyParcel.

Getting started

  1. Add this to your plugins in vendure-config.ts:
import { MyparcelPlugin } from 'vendure-plugin-myparcel';

plugins: [
  MyparcelPlugin.init({
    vendureHost: 'https://your-vendure-host.io',
    syncWebhookOnStartup: true, // If you want to automatically set vendureHost as webhook on MyParcel account
  }),
  ...
]
  1. Add MyparcelPlugin.ui to your AdminUiPlugin extensions:
import { MyparcelPlugin } from 'vendure-plugin-myparcel';

plugins: [
  AdminUiPlugin.init({
    port: 3002,
    route: 'admin',
    app: compileUiExtensions({
      outputPath: path.join(__dirname, '__admin-ui'),
      extensions: [MyparcelPlugin.ui],
    }),
  }),
];

Read more about Admin UI compilation in the Vendure docs

  1. Start Vendure and go to Settings > MyParcel and fill in your MyParcel API key.
  2. Create a shipmentMethod with MyParcel fulfillment.
  3. Place an order and select the shippingMethod.
  4. Go to the Admin UI and click on fulfill
  5. Your shipment should be in your MyParcel account.

Customs information for shipments outside the EU

MyParcel requires additional customs information for shipments outside the EU. When you ship outside the EU, you should implement the getCustomsInformationFn when initializing the plugin:

MyparcelPlugin.init({
  vendureHost: 'https://your-vendure-host.io',
  getCustomsInformationFn: (orderItem) => {
    return {
      weightInGrams: (orderItem.line.productVariant.product.customFields as any)
        .weight,
      classification: (
        orderItem.line.productVariant.product.customFields as any
      ).hsCode,
      countryCodeOfOrigin: 'NL',
    };
  },
});

You can find more information about the classification codes here.