Digital Products
Hoikka supports both physical and digital products. The product type field (physical or digital) determines checkout behavior.
How It Works
- Physical products require a shipping address and go through the shipping provider flow.
- Digital products skip shipping entirely. After payment, they trigger email delivery with download links or access instructions.
Changing the Default Product Type
The default type for new products is set in src/lib/config/products.ts:
export const DEFAULT_PRODUCT_TYPE: ProductType = "physical";
export const PRODUCT_TYPES: ProductType[] = ["physical", "digital"];- Change
DEFAULT_PRODUCT_TYPEto"digital"if the store primarily sells digital products. - The
PRODUCT_TYPESarray controls which types are available. If it contains two or more types, a Product Type selector is shown in the admin product page. If only one type is listed, the selector is hidden and all products use that type.
Setting a Single Product as Digital
When both product types are configured in PRODUCT_TYPES, a Product Type selector appears in the admin product page sidebar. Use it to switch any product between physical and digital.
You can also update the type programmatically:
await productService.update(123, { type: "digital" });Checkout Behavior
When all items in a cart are digital:
- The shipping step is skipped
- No shipping address is collected
- After successful payment, the order transitions to
Delivered
When a cart contains a mix of physical and digital products, the standard shipping flow applies for the physical items.
Last updated on