How to append a dynamic product title to the end of a URL in a JSON product template

Solved

How to append a dynamic product title to the end of a URL in a JSON product template

saturdayrepub
Shopify Partner
10 1 8

Hi, 

 

We need to adjust our theme's product template to include the product title at the end of a button's URL. The button links out to an external form and we want to pass the product title into the form, and have that product title change based on which product detail page the customer is on. 

 

I've tried adding product.title to the end of the URL, inside the quotes (following the format I see in other places in the template where product info is referenced), but get the error:

 

  • Setting 'url' does not support application type 'partial'.

Code example is below from our product json template:

 

 

 

 "db3e4b3f-a90f-4e06-96c2-247072ce9d75": {
          "type": "button",
          "settings": {
            "text": "Learn More",
            "url": "https:\/\/forms.zohopublic.com\/ourcompany\/form\/InquiryForm\/formperma\/_131?topic={{ product.title }}",
            "btn_style": "solid",
            "icon": "none",
          }
        },

 

 

 

 

I'm not sure how to add this dynamic URL parameter, any help would be appreciated. Thank you!

Accepted Solution (1)

gr_trading
Shopify Partner
2044 149 206

This is an accepted solution.

Hi @saturdayrepub 

 

You can use theme customise option and use metafield as URL.

 

 

For any custom development WhatsApp or connect at Email ID: support@grtrading.in for quick consultation. | Shopify Free codes
To support Buy Me a Coffee

View solution in original post

Replies 2 (2)

gr_trading
Shopify Partner
2044 149 206

This is an accepted solution.

Hi @saturdayrepub 

 

You can use theme customise option and use metafield as URL.

 

 

For any custom development WhatsApp or connect at Email ID: support@grtrading.in for quick consultation. | Shopify Free codes
To support Buy Me a Coffee
saturdayrepub
Shopify Partner
10 1 8

Thanks, I did end up using a metafield solution even though it means more to manage on each product.