โ๏ธ GetPolicyOptions
Type
The getPolicy()
function accepts an options
object to customize how a single policy is fetched โ whether it's a native Shopify policy or a custom page by handle.
type GetPolicyOptions = {
type: PolicyType;
customHandles?: Record<string, string>;
language?: string;
debug?: boolean;
};
๐งพ type
โ
type: "privacyPolicy" |
"refundPolicy" |
"shippingPolicy" |
"termsOfService" |
"legalNotice";
The type
refers to either a native Shopify policy (like privacyPolicy
) or a custom-defined one like "legalNotice"
.
๐งฉ customHandles
โ
customHandles: {
legalNotice: "mentions-legales",
termsOfUse: "terms-and-conditions",
};
Override native policy types or define new custom ones by specifying a mapping of policy type โ page handle.
If a handle is provided here for a policy type
, the page is fetched using the Pages API instead of the native policy from Shopify's shop
object.
๐ language
โ
language: "fr";
Used for multi-language awareness, primarily to emit debug warnings.
Shopify Storefront API does not support native policy localization.
๐ debug
โ
debug: true;
If enabled, warnings and fallbacks are logged using console.warn()
โ useful during development to detect missing or misconfigured policies.
โ Next: Result Types โ
Description
Type definition for the options object used in getPolicy().