📦 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:
Key | Type | Description |
---|---|---|
type | string | Policy type: "privacyPolicy" , "legalNotice" , etc. |
title | string | The title of the policy |
handle | string | The URL handle (slug) for this policy |
id | string | Internal ID of the policy |
published | boolean | True if the policy has content and is published |
from | "shop" | "page" | Indicates whether it came from the Shopify native policy or a CMS page |
url | string | Native policy URL (only if from === "shop" ) |
body | string | HTML 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.