Getting dynamic properties from Line Items and Network Access for validations

Question 1: Dynamic Cart Line Attributes

Our use case involves applying discounts based on dynamically named cart line properties, like _offer_version_#{offerId}.

The issue is that the attribute field in the Checkout Functions API requires a hardcoded key, making it impossible for us to access these properties with a variable name. We need to be able to access properties like attribute(key: "offer_version_123") where the 123 is a dynamic value.

Is there a recommended method or a new API feature that allows us to dynamically access cart line properties within a Shopify Function?

------------------------------------------

Question 2: Network Access for Shopify Plus

We’re interested in using the Network Access feature (fetch target) for Discount Functions to perform server-to-server transaction validation.

However, it appears this functionality is currently limited to Enterprise clients. Are there any plans to make the fetch target available for Shopify Plus plans?

Depending on how you setup the offers there are a couple of approaches you could take here. We do offer dynamic attributes on a per Function configuration leveraging input query variables.

Essentially how it would work is you’d set a JSON metafield with the value of the offer

{  “offerId”: 123}

Then within your shopify.extension.toml you’ll add a section like this to the location you store that JSON metafield

[extensions.input.variables]
namespace = "$app"
key = "variables"

Within your input query you’d then pass in that variable of $offerId as part of the query.

Another approach is to split up the attribute into an offer_idkey and an offer_value key and fetch both of those as part of your input leveraging aliases.

On the network access question, currently we don’t plan on increasing availability of network access.

Thank you, will check this.