At the moment, Cart Transform functions only provide access to the product or variant titles of cart lines, which makes it hard to implement more advanced logic.
Would it be possible to expose product.options or variant.selectedOptions in functions? Having access to either would open up a lot of useful use cases.
Hey @Anton - you’re right that at the moment we do only expose product variant info, not specifically product option data within the Cart Transform Functions API:
At the moment, I think the best workaround would be to store the option data (like ID, etc.) as a metafield on either the product or product variant object itself, but I definitely get how that might be a bit redundant since the general Storefront GraphQL API does expose the option object out of the box.
I can’t guarantee anything on my end here, but I’ll do some digging to see if we are looking at exposing option data in Cart Transform Functions in the future - I’ll loop back with you here once I have more info.
Hey @Anton - thanks for your patience on my reply here. I was able to get in touch with our Checkout/Carts product team and can confirm that we don’t expose product option data through the Cart Transform Functions API at the moment.
I can’t guarantee if this feature will be added to the API, but I’ll put through a feature request for you on my end so that we have this officially logged.
Hope this helps - let me know if I can help out further at all
Thank you for checking with the team and for flagging this feature request for me.
I believe it should be relatively safe to expose this because functions are already limited by query complexity, so there’s no additional performance risk.
Exposing those fields would help us a lot in implementing advanced logic. Thank you for suggesting duplicating options in metafields, but as you pointed out, it’s not ideal because in some cases we would need to duplicate it across thousands of products and, more importantly, keeping metafields up to date would be a challenge.
It would be really great to unify the available data across different APIs, especially given the upcoming 2048 variants limit increase. Product options are an even more important part of product structure now.