How to get metaobject applied to current checkout in checkout ui extensions

How to get metaobject applied to current checkout in checkout ui extensions

dev_dnShop
Shopify Partner
26 1 0

Hi,
Can we read metaobjects in the checkout UI extension? Is there any hook to just grab data of metaObject applied to the current checkout in checkout UI extensions?

Replies 2 (2)

jamalali81
Shopify Partner
23 0 4

Did you find a solution for this?

dev_dnShop
Shopify Partner
26 1 0

@jamalali81 Presently, the Shopify checkout UI extensions do not have a built-in hook or API that directly provides details about applied metaobject data during the current checkout process.

However, they do offer a meta fields hook to retrieve unique IDs that can be used for individual metaobject details at checkout.

Utilizing this ID, we can retrieve metaobject data. The process involves calling the Shopify GraphQL API for each item in the cart. For instance, if there are 10 different items in the cart with different metaobject groups, we need to first fetch the IDs of these 10 metaobject groups. Subsequently, for each ID, we make separate calls to the storefront GraphQL API to obtain respective production group data. This can lead to multiple API calls during checkout, potentially risking checkout stability, especially as the number of items in the cart increases. Therefore, there's a risk of checkout instability or delays as a result of this heightened API activity.

To address this, You can consider a better approach: implementing a backend endpoint call from the checkout process. This backend endpoint would handle all the necessary GraphQL API calls and data processing, consolidating the numerous calls from the storefront into a single backend call.