Skip to content

Access shop metafields within Delivery Customization #297

@meandillar

Description

@meandillar

We need a way to access metafields in the function Input other than those that are owned by the Delivery Customization - for example shop metafields. Is this possible?

Background
We have a Plus store and currently use a combination of JS in checkout.liquid and Shopify Scripts to achieve our shipping customisations. There are a few main things we do:

  • Hide irrelevant shipping options based on customer postcode
  • Rename shipping options according to the current time, based off some "shipping cutoff times" (for example depending on the shipping cutoff time the option title could display as "Same Day Delivery", "Next Day Delivery" or "Next Working Day")
  • Display estimated delivery times as a subtitle
  • Discount the shipping rate based on customer tags

It seems like we'll need to use a combination of a Delivery Customization, a Checkout UI Extension and a Shipping discount function to achieve these things.

Our Problem
The problem we're having is sharing our preset "shipping cutoff times" between the Delivery Customization and the Checkout UI Extension. Currently they are stored in metafields on the shop. We could theoretically access these via the storefront API in the Checkout UI Extension but not in the Delivery Customization. If we set the metafields on the Delivery Customization they are not accessible in the Checkout UI Extension because the Delivery Customization objects aren't available via Storefront API.

Any suggestions would be greatly appreciated :-)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions