Adding In stock option values in the product meta field

Topic summary

A developer wants to automatically populate a product’s custom metafield with available “In Stock” option values (e.g., sizes 20, 22, 24).

Goal: Sync inventory-available product options to a metafield for displaying dynamic stock information elsewhere in the store.

Current Status: The question remains unanswered with no solutions or guidance provided yet.

Summarized with AI on November 2. AI used: claude-sonnet-4-5-20250929.

I would like to update a product’s custom metafield with its available “In Stock” option values.

Here’s my use case:

If a product has size options like 20, 22, and 24 listed in the product options and available inventory for these sizes, I want to automatically reflect this data in the corresponding product metafield. This will allow me to use the metafield to display dynamic stock information elsewhere in my store.

Could someone guide me on how to achieve this?

2 Likes