Can't reference original uploaded video filenames in liquid?

Client is uploading product media in bulk via middleware. Their existing system has worked great for product images.

They do this business logic:
[sku]_[sort order]_[some seo text].jpg

They wanted us to support video, so the team can shoot video and upload them. Great.

Issue is, Shopify changes the filenames once they go to the Product object. So any uploaded video we can’t seem to access this original filename anywhere unless I’m missing it.

Not an issue with images – but are the media object video source urls hashed? Can we reconstruct the uploaded file name to get it?

I’m looking in Content → Files and it’s correct when it is in Files, but there doesn’t seem to be a way in liquid to query that without knowing the full filename already.

Hi @Sean the product.media object in Liquid does not offer a property for original filename but you could have your middleware also store this as a metafield on the product or variant.

Another approach would be to put the original name (or your SEO text) in the video’s alt text or description, but that depends on your workflows and whether you want that text surfaced to end customers.

Thanks. I actually just found a workaround without involving the middleware.

This admin graph api will actually expose the original filename:

So with a bit of Shopify Flow, and possibly using Flow Plus to extend the triggers (for now just using Product Status Update in Shopify Flow)

Here I’m using Shopify Flow to set the product metafield to have the original filename.

1 Like