Discuss and resolve questions on Liquid, JavaScript, themes, sales channels, and site speed enhancements.
Hello Everyone,
I have configured my app to make custom metaobjects to be accessible via the storefront API. I am able to retrieve these custom metaobjects with my liquid theme extensions. However, when I try to retrieve them with a checkout theme extension, it seems to retrieve the metaobjects but they are empty.
Here it shows that the the metaobjects have been created for this test store and are accessible via the storefront:
Here is where I set the storefront access to PUBLIC_READ and enable them as “publishable”:
const METAOBJECT_VARIABLES = { definition: { name: "DonaSettings", type: "DonaSettings", access: { storefront: "PUBLIC_READ" }, capabilities: { publishable: { enabled: true } }, fieldDefinitions: [ { key: "donateMealsChecked", name: "Donate Meals Checked", type: "single_line_text_field" }, { key: "limitEnab......
Here is the logic of my theme extension for getting the metaobjects with a graphql query:
export default reactExtension( 'purchase.checkout.block.render', () => <Extension />, ); function Extension() { const [configData, setConfigData] = useState(null); const { query } = useApi(); useEffect(() => { query( ` query ($first: Int!, $type: String!) { metaobjects(first: $first, type: $type) { nodes { id handle fields { key value } } } } `, { variables: { first: 5, type: "DonaSettings" } } )
Here are the access scopes I have enabled:
[access_scopes] # Learn more at https://shopify.dev/docs/apps/tools/cli/configuration#access_scopes scopes = "read_orders, read_marketplace_fulfillment_orders, read_metaobjects, write_metaobjects, write_metaobject_definitions, unauthenticated_read_checkouts, unauthenticated_read_metaobjects"
Here is my extension toml:
api_version = "2025-01" [[extensions]] name = "Checkout Badge" handle = "donation-checkout" type = "ui_extension" [[extensions.targeting]] module = "./src/Checkout.jsx" target = "purchase.checkout.block.render" [extensions.capabilities] api_access = true
Any help would be much appreciated. Just not sure why the metaobjects query is returning as empty?
Thanks in advance!
Learn how to build powerful custom workflows in Shopify Flow with expert guidance from ...
By Jacqui May 7, 2025Did You Know? May is named after Maia, the Roman goddess of growth and flourishing! ...
By JasonH May 2, 2025Discover opportunities to improve SEO with new guidance available from Shopify’s growth...
By Jacqui May 1, 2025