Hi,
With Shopify SDK and API, I was able to generate a couple of metafields and the below is the array that I printed after successful creation and updating of the metafield value.
Array
(
[id] => 28932645388592
[namespace] => reflectperfection
[key] => logo_tag
[value] => Test
[description] =>
[owner_id] => 73156460848
[created_at] => 2023-06-16T08:33:42-07:00
[updated_at] => 2023-06-17T06:54:35-07:00
[owner_resource] => shop
[type] => string
[admin_graphql_api_id] => gid://shopify/Metafield/28932645388592
)
Array
(
[id] => 28932646109488
[namespace] => reflectperfection
[key] => logo_date_info
[value] => Test
[description] =>
[owner_id] => 73156460848
[created_at] => 2023-06-16T08:36:00-07:00
[updated_at] => 2023-06-17T06:54:35-07:00
[owner_resource] => shop
[type] => string
[admin_graphql_api_id] => gid://shopify/Metafield/28932646109488
)
However, trying to print these metafield data in header.liquid file is printing nothin as if these fields were never created or updated. We are not using any metafield app and I don’t know if there is a way to view these newly created metafields(Via API) in Shopify admin. Code in header.liquid is as follows.
{%- assign eventDate = '' -%}
{%- if shop.metafields.reflectperfection.logo_tag != "normal" -%}
{% assign sourceLogoTagUppercase = **shop.metafields.reflectperfection.logo_tag** | upcase %}
{%- assign sourceLogoFile = 'logo' | append: sourceLogoTagUppercase | append: '.png' -%}
{%- if **shop.metafields.reflectperfection.logo_date_info** != "normal" -%}
{%- assign eventDate = shop.metafields.reflectperfection.logo_date_info -%}
{%- endif -%}
{%- endif -%}
