Skip to main content

📦 FetchPolicyResult Type

The getPolicy() function returns a standardized object that includes a single policy page or Shopify native policy.

type FetchPolicyResult = {
data: PolicyEntry | null;
error: string | null;
};

📄 data: PolicyEntry | null

The returned data field contains a single PolicyEntry object, or null if the policy wasn’t found.

type PolicyEntry = {
type: PolicyType;
title: string;
handle: string;
id: string;
published: boolean;
from: "shop" | "page";
url?: string;
body?: string;
};

Fields:

KeyTypeDescription
typestringPolicy type: "privacyPolicy", "legalNotice", etc.
titlestringThe title of the policy
handlestringThe URL handle (slug) for this policy
idstringInternal ID of the policy
publishedbooleanTrue if the policy has content and is published
from"shop" | "page"Indicates whether it came from the Shopify native policy or a CMS page
urlstringNative policy URL (only if from === "shop")
bodystringHTML string of the full policy content (only present in getPolicy())

error: string | null

If something went wrong, you’ll get a human-readable error string instead of a policy object.

Always check for error before rendering.


Description

Type definition for the getPolicy() result structure.