Use the shared storefront runtime to read normalized Measura measurements from Shopify cart line items.
window.Measura.getCartItemMeasurementByKey(lineItemKey, options?)Looks up a cart line item by Shopify line item key and returns its normalized Measura measurement.
options.cart when provided, otherwise falls back to window.MeasuraCart when available.lineItemKey: string | number
options?: {
cart?: {
items?: Array<{
key?: string | number;
properties?: Record<string, any>;
}>;
};
}{
measurement: {
type: "weight" | "length" | "area" | "volume" | "time";
value: number;
unit: string;
dimensions: Array<{
value: number;
unit: string;
}>;
};
} | nullnull when the key is missing, the item is not found, or the item is not a Measura item.const result = window.Measura.getCartItemMeasurementByKey("794df6e3f3c4f4b1f9e9f3b7f7b1b2c4", {
cart
});