Front-end metafield reference
Full reference for the metafields applied by Submarine to various Shopify objects, for access in Liquid templates and the Shopify Storefront API.
Overview
As described in the front end integration overview, Submarine augments products and variants that are part of presale or crowdfunding campaigns with metafields that allow front-end developers to display campaign information to customers via Liquid or the Storefront API.
A single metafields is attached per campaign type attached in the
submarine
namespace — for example, product.metafields.submarine.presales
contains all product-level information relating to presale campaigns, while product.metafields.submarine.crowdfunding
contains all product-level information relating to crowdfunding campaigns.Product metafields
Presales
Information about all presale campaigns a product has been part of, including historical campaigns, is available in a single
product.metafields.submarine.presales
metafield as a JSON object array.Each campaign object has the following properties:
Property key | Property type | Example value | Notes |
id | String | 4f2b1c79-49c5-4ad2-af14-5034623ce62e | The unique Submarine ID for the presale campaign. |
name | String | Spring Launch | The name of the presale campaign as defined in the Submarine Admin. |
status | String | pending | The current status of the presale campaign. One of pending , allocated , paid , completed or cancelled . |
launch_at | String | 2023-02-06T16:31:18Z | The time the campaign is scheduled to launch, or when it did launch, in ISO8601 format. |
end_at | String | 2023-02-18T14:00:00Z | The time the campaign is due to end, or when it did end, in ISO8601 format. |
fulfill_at | String | 2023-06-11T12:30:00Z | The time the campaign is due to be fulfilled, or when it was fulfilled, in ISO8601 format.
Note that not all presale campaigns require a scheduled fulfilment date, so this value may be null . |
limit | Number | 1500 | The total limit of units to be sold for this campaign across all products and variants that are part of the campaign. |
reserved | Number | 467 | The total number of units that have been sold for this campaign across all products and variants that are part of the campaign. |
Here’s an example JSON value for a product’s presale metafield for a product that has been part of two presale campaigns, one active and one completed:
[ { "id": "4f2b1c79-49c5-4ad2-af14-5034623ce62e", "name": "Spring Launch", "status": "ended", "launch_at": "2022-10-04T00:00:00Z", "end_at": "2022-10-10T00:00:00Z", "fulfill_at": "2022-11-06T00:00:00Z", "limit": 1000, "reserved": 745 }, { "id": "44bf0a37-f21c-4257-93f0-e2e3cd58d631", "name": "Summer Launch", "status": "launched", "launch_at": "2022-10-04T00:00:00Z", "end_at": "2022-10-10T00:00:00Z", "fulfill_at": null, "limit": 2000, "reserved": 188 } ]
Variant metafields
Presales
Variants that have been part of a presale campaign have a
variant.metafields.submarine.presales
metafield attached that exposes information relevant to that variant within each campaign.While this metafield is also a JSON value, unlike the product metafield it’s a JSON object that maps Submarine campaign IDs to the variant-specific properties for that campaign.
The properties are:
Property key | Property type | Example value | Notes |
reserved | Number | 22 | The total number of units of this variant that have been sold for a campaign. |
Here’s an example JSON value for a variant’s presale metafield, assuming it was part of both of the campaigns defined in the product example above:
{ "4f2b1c79-49c5-4ad2-af14-5034623ce62e": { "reserved": 106 }, "44bf0a37-f21c-4257-93f0-e2e3cd58d631": { "reserved": 76 } }