Button Links to Dynamic Metaobject Product Collections

Button Links to Dynamic Metaobject Product Collections

CoffeeSam
Not applicable
1 0 0

I'm trying to make a dynamic button that directs to a product collection. The collection is based off of the metaobject definition, and I"m hoping to make the button a dynamic button that will link to the proper collection of the page. I'm getting this error. Can anyone help me out?

Screen Shot 2025-03-06 at 6.43.01 PM.png

Reply 1 (1)

TheUntechnickle
Shopify Partner
355 34 93

 

Hey @CoffeeSam

In Shopify, the "button_link" property typically doesn't support Liquid templating the way you're trying to use it. For dynamic links in Shopify JSON templates, you'll need to use a different approach.

 

Here are some solutions to try:

 

  1. If you're working in a JSON template file, try using the url_for_type Liquid filter. Replace your current line with something like:

    "button_link": "{{ metaobject.name.value | handleize | prepend: '/collections/' }}"
  2. Another approach is to use a URL object format that Shopify supports:

    "button_link": "{{ routes.collections_url }}/{{ metaobject.name.value | handleize }}"
  3. If you're building a section schema, you might need to set up a proper link picker instead of directly embedding Liquid in the JSON:

    "button_link_field": {
      "type": "url",
      "label": "Button Link",
      "default": "/collections/all"
    }

    And then reference that field elsewhere.

  4. If your specific button component doesn't support dynamic values through Liquid, you may need to create a custom block or section that can handle this dynamically on the server-side.

 

Shopify's JSON templates have specific requirements for how dynamic values are passed. The error suggests that the "partial" application type isn't supported for button links, which makes sense because Shopify expects complete URLs for navigation elements.

 

Feel free to reach out over email if you need any more help 🙂

Cheers!
Shubham | Untechnickle

Helping for free: hello@untechnickle.com


Don't forget to say thanks, it'll make my day - just send me an email! 


Get Revize for Free | Let your shoppers edit orders post-purchase | Get Zero Support Tickets | #1 Order Editing + Upsell App