Ruby: MetaFields are not accessible via REST API

Ruby: MetaFields are not accessible via REST API

bilalahmed344
Visitor
1 0 0

Hi there!

I am working on Ruby on Rails, I have used a gem called shopify_api
I have created a few meta fields on the dashboard(Settings -> Custom data -> Products), These fields are visible on the dashboard & each product detail page but when I tried to fetch them via API, it didn't return those fields.

      session = ShopifyAPI::Auth::Session.new(
        shop: shopify_domain,
        access_token: shopify_token
      )
      @client = ShopifyAPI::Clients::Rest::Admin.new(
        session: session
      )
      response = @client.get(path: 'metafields', query: { limit: 250 })
      metafields = response.body['metafields']

Screenshot 2024-07-30 at 1.11.50 PM.png

 

Then I used an API for creating metafields, These fields were created successfully but they show under unstructured(Settings -> Custom data -> Products -> top button 'View unstructured metafields'). These fields created from API are also not showing on the product detail page until I click on 'View unstructured metafields'

Screenshot 2024-07-30 at 1.28.12 PM.png

Replies 0 (0)