How can I extract certain product information from the Shopify product description?

There may be cases where you've placed additional product information directly in the product's HTML description since you didn't find anywhere else to put them in Shopify.

Product variant options, for instance, is limited to 3 options and there are no built-in fields for attributes such as the item's condition. You can add additional product attributes using Metafields, but it requires a third-party app to add them.

You might also have imported the product data from another platform which put all the product details in the HTML description.

This can be a problem if you then have to generate a product feed from this data to use in another platform that needs the product information in separate columns in a CSV file.

If there's a consistent structure in the HTML description where the information you need is labeled, EZ Exporter might be able to extract them and place them in separate columns in the CSV export.

For example, your product description might look something like this:

Shopify product description with additional product attributes

As you can see above, there's a section that lists the additional product attributes such as the "Weight" and "Condition" in a consistent "Attribute Name: Value" format where each attribute is a separate line.

If you export this product description to CSV, you'll get the HTML code that looks something like this:

<p>Meow. This cat is a pain in the behind, you can have it, pay only shipping.</p>
<p><strong>Weight: </strong>45lbs<br><strong>Condition:</strong> Healthy<br><strong>Favorite Activity: </strong>Eat and siesta<br></p>
<p>Gets along well with dogs, a bit picky with food.<br></p>

EZ Exporter can parse this information and pull those labeled product attributes using a formula like this in the Calculated Fields:

search_list(strip_html_tags({{ body_html }}.replace("<br>", "\n")).split("\n"), "Condition:", return_all_results=False).replace("Condition:", "").strip()

The formula above will pull the value after "Condition: " and place it on a separate field. As you can tell, this is a very complex formula that combines multiple functions just to retrieve that data.

The main thing to note here is the part where it says "Condition:". You can basically just copy and paste this formula into additional Calculated Fields and replace that part with the name of the attribute you'd like to extract.

Here's an example of formulas that extract the Weight, Condition, and Favorite Activity attributes:

EZ Exporter - Extract product attributes from Shopify product description

And the output will look something like this:

EZ Exporter - Extract product attributes from Shopify HTML descriptions to CSV

Please note that our app can only extract these product attributes from the product descriptions if there's a consistent structure of one attribute per line and where each attribute is labeled.

App: EZ Exporter

Tags: advanced features, product feeds, calculated fields, product description