Skip to content
This repository has been archived by the owner on Jan 15, 2022. It is now read-only.

πŸ“¦ A series of plugins for Vendure to add features to shipping using boxes, and shipping based on product dimensions.

License

Notifications You must be signed in to change notification settings

jonyw4/vendure-advanced-shipping

Repository files navigation

Vendure Advanced Shipping

Publish Build & Test semantic-release Crowdin

πŸ“¦ A series of plugins for Vendure to add features to shipping using boxes and shipping based on product dimensions.

🌟 Features

  • CRUD of packages/boxes. (Both admin UI / GQL)
  • Ability to add dimensions in Product (Using Custom Fields)
  • A table in the database to register all packages of an order.
  • A ShippingPackages service helper to calculate which box to use in Order and update the order in the database

βš™οΈ Install

1. Install and configure Vendure

Here you can find out how to install

2. Install the core package

npm install @vendure-advanced-shipping/core --save

2.1 Install the optional packages or create one. (Optional)

You can find the list of available packages compatible with this repo in the list PACKAGES above.

3. Add all plugins in Vendure configuration

import { AdvancedShippingCorePlugin } from '@vendure-advanced-shipping/core';
const config: VendureConfig = {
  ...
  plugins: [
    AdvancedShippingCorePlugin
  ]
}

4. Extend the UI plugin (optional)

You need to extend the UI adding the uiExtensions in the compileUiExtensions of the AdminUiPlugin. You can read more about how to config here

import { AdvancedShippingCorePlugin } from '@vendure-advanced-shipping/core';
const config: VendureConfig = {
  ...
  plugins: [
    ...
    AdminUiPlugin.init({
      ...
      app: compileUiExtensions({
        ...
        extensions: [AdvancedShippingCorePlugin.uiExtensions],
      })
    })
  ]
}

5. Enjoy!

It's done!

πŸ“š How to use?

1. Create your first package box

Step 1.1 Step 1.2 Step 1.3

2. Configure your products dimensions

Step 2

3. Configure your shipping products

Step 2

4. Done, enjoy!

πŸ“– Packages

npm (scoped) @vendure-advanced-shipping/core

This package contains the core features of Advanced Shipping.

npm (scoped) @vendure-advanced-shipping/melhor-envio

A plugin using the Advanced Shipping for calculate shipping using Melhor Envio as provider

npm (scoped) @vendure-advanced-shipping/rodonaves

A plugin using the Advanced Shipping for calculate shipping using Rodonaves as provider

npm (scoped) @vendure-advanced-shipping/ups-brazil

A plugin using the Advanced Shipping for calculate shipping using UPS Brazil as provider

npm (scoped) @vendure-advanced-shipping/pickup-in-store

A plugin to pickup order in store.

  • A ShippingCalculator to create multiple stores to customer pickup the order based on Postal Code.
  • A PickupInStoreCronService that adds a cronjob that checks every day at mid night orders that its in the state of Packed in the interval of 7 days and that the shipping method its pickup-in-store (the same from the ShippingCalculator) after get, the service will cancel all of then.
  • A PickupInStoreCancelOrder event that fired whenever an Order is cancelled by Cron Job

πŸ‘¨πŸ»β€πŸ’» Creating a shipping calculator / plugin

It's really easy to create a ShippingCalculator in Vendure and this project takes advantage of it. You just need to create a new ShippingCalculator class that will inject in his init function, your ShippingPackagesService so that you can get which packages boxes to use in this order. You can get here an example to how to do it.

🏒 Structure

This project is a monorepo managed with Lerna. Several npm packages are published from this repo, which can be found in the packages/ directory.

βœ… Testing

Server Unit Tests

The core and several other packages have unit tests which are can be run all together by running npm test from the root directory, or individually by running it from the package directory.

Unit tests are co-located with the files which they test, and have the suffix .spec.ts.

End-to-end Tests

Certain packages have e2e tests, which are located at /packages/<name>/e2e/. All e2e tests can be run by running yarn e2e from the root directory, or individually by running it from the package directory.

e2e tests use the @vendure/testing package. For details of how the setup works, see the Testing docs

🌐 Localization

This project localization its hosted in Crowdin.

❗️ License

MIT