email-utils.md 2.3 KB


title: "Email Utils" isDefaultIndex: false

generated: true

import MemberInfo from '@site/src/components/MemberInfo'; import GenerationInfo from '@site/src/components/GenerationInfo'; import MemberDescription from '@site/src/components/MemberDescription';

transformOrderLineAssetUrls

Applies the configured AssetStorageStrategy.toAbsoluteUrl() function to each of the OrderLine's featuredAsset.preview properties, so that they can be correctly displayed in the email template. This is required since that step usually happens at the API in middleware, which is not applicable in this context. So we need to do it manually.

Note: Mutates the Order object

function transformOrderLineAssetUrls(ctx: RequestContext, order: Order, injector: Injector): Order

Parameters

ctx

RequestContext`} />

order

Order`} />

injector

Injector`} />

hydrateShippingLines

Ensures that the ShippingLines are hydrated so that we can use the shippingMethod.name property in the email template.

function hydrateShippingLines(ctx: RequestContext, order: Order, injector: Injector): Promise<ShippingLine[]>

Parameters

ctx

RequestContext`} />

order

Order`} />

injector

Injector`} />