Metafields - Add Link Button To Product Page

Hello,

I try yo add a custom Liquid to add a download link in product page.

I add the metafiled “scheda_prodotto” (single file) and I try to add but I assume I’m doing something wrong.

DOWNLOAD

Could you help me figure out where I’m wrong?

1 Like

However, there is a small mistake in the liquid variable you used to access the metafield. Instead of product.metafields.custom.scheda_prodotto, you should use product.metafields.your_namespace.scheda_prodotto, where “your_namespace” is the namespace you have assigned to your metafields.

Here’s an updated code snippet:

DOWNLOAD

Hello @MarcoIngShop

Based on the code you provided, it looks like you’re trying to create a download link in the product page using a custom metafield called “scheda_prodotto.” However, it seems that there might be an issue with accessing the value of the metafield correctly.

To properly retrieve the value of a custom metafield in Shopify, you need to specify the namespace and key of the metafield. Here’s the modified code that should work:

DOWNLOAD

Replace namespace with the actual namespace you used when creating the metafield. By default, custom metafields created through the Shopify admin have the namespace set to custom.

If you’re still facing issues, make sure to double-check the following:

  1. Verify that the metafield has been correctly added to the product in the Shopify admin.
  2. Confirm that you’re using the correct namespace and key in the Liquid code.
  3. Ensure that the metafield value is a valid URL for the download link.

By addressing these points and using the modified code, you should be able to create a download link on the product page using the value from the custom metafield.

I add Metafield to “Prodotti”

and I see product.metafields.custom.scheda_prodotto

This seems to be correct and what code you are entering?

DOWNLOAD

In product page I set pdf file

Hi @MarcoIngShop ,

Here is the updated code that you can use
Download

If I managed to help you then, don’t forget to Like it and Mark it as Solution!

So I have 404 not found but, following your suggestion, I set to

SCHEDA PRODOTTO

and now it works. Thanks a lot.

Please Mark it as Solution