Suggestion: include cart token (or similar) in cart validation function input

There should be some Shopify-authoritative unique identifier of the cart present on cart validation function input. Something like the cart token would be great.

I have a use case that for using a cart validation function to verify that a token included in the cart attributes is valid and tied uniquely to that cart. Not the cart contents, the cart instance. For obvious reasons, I can’t rely on anything client-assignable (e.g. cart attributes) to communicate an identifier to the function, because the tokens would be trivially replay-able across carts.

I don’t believe including such an identifier on function input would violate the principles of the function framework. Execution would still be deterministic: given the same cart attributes and the same identifier, the result would be the same.

1 Like

I think I’ve just ran on this problem today.

A client used the Cart api to add an attribute that shouldn’t be added in his case.

This would be useful, for me it’s checkout token.