Skip to main content

โš™๏ธ 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().