In this article, I'll explain how to link a specific PDF document to a particular product dynamically.
To add this feature to your Shopify store, you have to use Shopify's metafields, Here’s a simple guide to set it up:
1. Create metafields
- Navigate to your Shopify Admin
- Go to Settings > custom data
- Create the metafields for the product.
2. Customize store
- Go to online store > themes > Customize
- Go to the Product page
- Add the collapsible row block to show Dynamic field
- Go to the heading and click the dynamic icon to add the metafield to show the heading and content.
- To link the specific file on specific product
- Again Go to the Customize product page and add the block named custom- liquid
- Now paste the provided Code
<p><a target =”_blank” href=”{{ product.metafields.custom.customfile | file_url }}”>initializing file </a></P>
- Now go to the product in which you want to link the pdf file and add the file in customfile metafield.
- Now save the changes .