Skip to main content

Digital Products

Digital products include things like ebooks, online courses, and software. They are products that are delivered to the customer electronically, and do not require physical shipping.

This guide will show you how you can add support for digital products to Vendure.

Creating the plugin

Info

The complete source of the following example plugin can be found here: example-plugins/digital-products

Define custom fields

If some products are digital and some are physical, we can distinguish between them by adding a customField to the ProductVariant entity.

src/plugins/digital-products/digital-products.plugin.ts
Note

You will need to create a migration after adding this custom field. See the Migrations guide for more information.

We will also define a custom field on the ShippingMethod entity to indicate that this shipping method is only available for digital products:

src/plugins/digital-products/digital-products.plugin.ts

Lastly we will define a custom field on the Fulfillment entity where we can store download links for the digital products. If your own implementation you may wish to handle this part differently, e.g. storing download links on the Order entity or in a custom entity.

src/plugins/digital-products/digital-products.plugin.ts

Create a custom FulfillmentHandler

The FulfillmentHandler is responsible for creating the Fulfillment entities when an Order is fulfilled. We will create a custom handler which is responsible for performing the logic related to generating the digital download links.

In your own implementation, this may look significantly different depending on your requirements.

src/plugins/digital-products/config/digital-fulfillment-handler.ts

This fulfillment handler should then be added to the fulfillmentHandlers array the config ShippingOptions:

src/plugins/digital-products/digital-products.plugin.ts

Create a custom ShippingEligibilityChecker

We want to ensure that the digital shipping method is only applicable to orders containing at least one digital product. We do this with a custom ShippingEligibilityChecker:

src/plugins/digital-products/config/digital-shipping-eligibility-checker.ts

Create a custom ShippingLineAssignmentStrategy

When adding shipping methods to the order, we want to ensure that digital products are correctly assigned to the digital shipping method, and physical products are not.

src/plugins/digital-products/config/digital-shipping-line-assignment-strategy.ts

Define a custom OrderProcess

In order to automatically fulfill any digital products as soon as the order completes, we can define a custom OrderProcess:

src/plugins/digital-products/config/digital-order-process.ts

Complete plugin & add to config

The complete plugin can be found here: example-plugins/digital-products

We can now add the plugin to the VendureConfig:

src/vendure-config.ts

Create the ShippingMethod

Once these parts have been defined and bundled up in a Vendure plugin, we can create a new ShippingMethod via the Dashboard, and make sure to check the "isDigital" custom field, and select the custom fulfillment handler and eligibility checker:

Create ShippingMethod

Mark digital products

We can now also set any digital product variants by checking the custom field:

Digital product variant

Storefront integration

In the storefront, when the customer is checking out, we can use the eligibleShippingMethods query to determine which shipping methods are available to the customer. If the customer has any digital products in the order, the "digital-download" shipping method will be available:

Graphql

If the "digital download" shipping method is eligible, it should be set as a shipping method along with any other method required by any physical products in the order.

Graphql
Was this chapter helpful?
Report Issue
Edited Feb 23, 2026ยทEdit this page