custom button linked to action metafield file

elfboss
New Member
13 0 0

Hi i need help with the following button

 

elfboss_0-1706177058474.png

I added this button on a custom product template. 

the code is :

<div class="somdn-download-wrap" style="margin-bottom: 50px; text-align: center;">
<button id="somdn-form-submit-button" class="somdn-download-button single_add_to_cart_button button" type="button">Download Now</button>
</div>

 

However i need the button to action a free instant download when clicked, linked to my metafile i created product.metafields.custom.printable_button 

every product has a different download file in the metafile section. 

unsure how to do this

 

i dont want a link it needs to be a button they press

Please help

 

Replies 9 (9)

Liqiud_xPert_SJ
Shopify Partner
406 43 61

Hi @elfboss 

 

Please refer to the below code update with your exsisting hopefully you will understand you just need to call the metafieldkey in the given code.

<div class="somdn-download-wrap" style="margin-bottom: 50px; text-align: center;">
<a href="{{ product.metafields.your-meta-field-key}}"id="somdn-form-submit-button" class="somdn-download-button single_add_to_cart_button button" type="button">Download Now</a>
</div>

 

Thanks

- Please don't forget to Like and Mark Solution to the post that helped you. Thanks!
- Your Shopify Solution Specialist For further discussion contact: Email ID- Liqud_3xPert_SJ OR Whatsapp
- Buy a Coffee for me to get more frequently help 🙂
- Hire Me to unlock the full potential of your e-commerce store Now 🙂
elfboss
New Member
13 0 0

Hi i tried adding this  new code you recommended and it didn't work button when clicked does no command. Can you confirm where this should be put?

 

<div class="somdn-download-wrap" style="margin-bottom: 50px; text-align: center;">
<a href="{{ product.metafields.custom.printable_button }}"id="somdn-form-submit-button" class="somdn-download-button single_add_to_cart_button button" type="button">Download Now</a>
</div>

 

Liqiud_xPert_SJ
Shopify Partner
406 43 61

@elfboss 

 

No worries just let me know if i can fix it for you 

 

Thanks

- Please don't forget to Like and Mark Solution to the post that helped you. Thanks!
- Your Shopify Solution Specialist For further discussion contact: Email ID- Liqud_3xPert_SJ OR Whatsapp
- Buy a Coffee for me to get more frequently help 🙂
- Hire Me to unlock the full potential of your e-commerce store Now 🙂
elfboss
New Member
13 0 0

Yes i would love assistance. As my previous reply

Liqiud_xPert_SJ
Shopify Partner
406 43 61

@elfboss 

 

Do you want me to fix this? for you ?

 

Thanks

- Please don't forget to Like and Mark Solution to the post that helped you. Thanks!
- Your Shopify Solution Specialist For further discussion contact: Email ID- Liqud_3xPert_SJ OR Whatsapp
- Buy a Coffee for me to get more frequently help 🙂
- Hire Me to unlock the full potential of your e-commerce store Now 🙂
elfboss
New Member
13 0 0

yes please

elfboss
New Member
13 0 0

Hi are you still able to help

elfboss
New Member
13 0 0

Its all ok. i fixed it myself

Kcook
Shopify Partner
1 0 0

Hi, can I ask how you fixed it? I want to achieve the same thing.