Render richtext metefield html in Flow? No access to metafield_tag

Render richtext metefield html in Flow? No access to metafield_tag

ChunkySteveo
Shopify Partner
17 0 5

I am at a blocked path with one of my flows, and wonder if anyone can help... 

I have a product metafield that is a richtext field, full of marked up HTML content - headers, paragraphs, links etc. I need to copy this richtext HTML content into a multi-line text field metafield for other uses.

 

I have a flow working for recently updated products, to run every e.g. hour/day, but within Flows - outputting metafield.value gives me the full JSON value of the richtext metafield value. Usually you would use "metafield_tag" to translate this into a readable HTML block of content, but using that tag gives an error in Flows that it's not supported.

Is there any way to extract the readable HTML of the richtext metafield to use within Flows? metafield_text and metafield_tag are not allowed within Flows.

Replies 4 (4)

ChunkySteveo
Shopify Partner
17 0 5

I almost have a possible solution by using the Admin API and a HTTP call, using - https://shopify.dev/docs/api/admin-rest/2024-01/resources/metafield#put-blogs-blog-id-metafields-met...

But I am still testing to see if I am able to manipulate the richtext JSON content at all in the HTTP call... will see, unless anyone can point me to a better idea?!

SomeUsernameHe
Shopify Partner
495 54 99

Use the Shopify Admin API through an HTTP request. This method allows manipulation of the rich text JSON content directly. Specifically, the PUT request on the Metafield resource can be utilized for this purpose.

Have I helped? Consider putting coffee in my mouth!
Buy Me a Coffee
ChunkySteveo
Shopify Partner
17 0 5

That's exactly what I started to do - didn't get chance to test if I could manipulate the richtext JSON .value. I assume I do all the manipulation within the http request content?

ChunkySteveo
Shopify Partner
17 0 5

I have setup a PUT/POST to update the metafield, but I am still unable to use "metafield_tag" or manipulate the contents/value of the richtext metafield - it's still processes as JSON, same as just using the "update metafield" Flow Action? Any ideas on how to show the richtext JSON as actual HTML?