metafields vs gadget record

I want to optimize my request time and store settings for the app in gadget record, however i was wondering if it would be more efficient to store it in shopify metafields. My app is read intensive and the gadget record probably gets called a few thousand times so i was just wondering if it would be more efficient to store these settings in shopify api and save up on request time
9 Replies
safwan
safwanOP7mo ago
or perhaps i store in both but the reading part i do using metafields in shopify api
Chocci_Milk
Chocci_Milk7mo ago
Hello, I think that it's generally best to store things in metafields and metaobjects if they're going to be fetched a lot by the storefront. That'll significantly reduce your request time
safwan
safwanOP7mo ago
no they're not being fetched by the storefront, its being used in the orders/create action
Chocci_Milk
Chocci_Milk7mo ago
In that case, why would you want it to be a metafield?
safwan
safwanOP7mo ago
just to save up on request time
Chocci_Milk
Chocci_Milk7mo ago
The metafield would need to be present on every order to save you request time. Metafields aren't a Gadget feature but instead a Shopify feature. You'll need to fetch the data from your database either way
safwan
safwanOP7mo ago
oh okay i was thinking something along these lines: store the srlettings in the app metafield as hson, for each orfer make a call tot he shopify api and parse the metafield value, and use the settings. Right now for each order i make a call to the internal api to use the data stored in the particular model for each store
Chocci_Milk
Chocci_Milk7mo ago
Calling the Shopify API would never be faster than calling your own API. You would also use up API call tokens
safwan
safwanOP7mo ago
oh alright

Did you find this page helpful?