Skip to content

factText

factText(product, fact, language?, labels?): string | undefined

Defined in: facts.ts:353

The text for one fact of one product, or undefined when the workspace has not stated it (the fallback then stays).

price is the amount formatted with its currency for language (Intl.NumberFormat(language, { style: "currency", currency })), or the raw amount when the currency is not known or cannot be formatted. amount is always the raw decimal string. availability is the label in labels for the stated state (in_stock or out_of_stock), and undefined when there is no label for it, when no labels are given, or when the state is "unknown": the stated code is data (product.availability), never text for a page. The same inputs give the same string on a server and in a browser that share the same Intl data.

FactProduct | undefined

"amount" | "name" | "price" | "currency" | "availability" | "sku" | "description"

string = "en"

Partial<Record<"in_stock" | "out_of_stock", string>>

string | undefined