I am trying to add a PDF file to my products which will contain special instructions for that product. I used metafield to store the information and set the type as file.
I see what you’re trying to implement here, and it’s great that you’re using the custom liquid block rather than editing the theme’s source code directly.
The code you shared is almost correct, but to generate the file URL, you’ll need to add a liquid filter. Please use the code below to properly generate the URL for the uploaded file:
Do not forget to check the Washing instructions for the product.
I hope this helps!
If my response helped you, please consider giving it a like ( ) and marking it as an accepted solution if it resolved your issue. Your feedback helps other community members with similar questions.
Hey @swym , I encountered another bug where this code displays for all products. Instead what I would prefer is that it should be only shown on products with PDF file.
I am trying to make something similar but with an audio player embed. If I write the code in the product description itself, it works. But if I try to do it on the theme editor, or code, by adding a reference to the metafield… it doesn’t allow me to save.
Any tips?