Help with liquid code to only show a button at order confirmation if work in product title

Topic summary

A yarn store owner needs help displaying a Ravelry library button on the order confirmation page only when purchased items contain “download” in the product or variant title. The button should appear once regardless of how many qualifying items were purchased.

Current situation:

  • The existing button code works correctly
  • Challenge is implementing a conditional check across multiple line items
  • Needs to avoid duplicate buttons when customers buy multiple patterns

Attempted solution:

  • A suggested Liquid code snippet uses a for loop to check if item.title contains "download"
  • Initial test unsuccessful, possibly due to case sensitivity

Status:

  • Original poster plans to conduct further testing
  • Discussion remains open with offer for additional troubleshooting
  • Alternative solution suggested: FileJar app with built-in Ravelry integration that handles this functionality automatically
Summarized with AI on October 30. AI used: claude-sonnet-4-5-20250929.

Hi there,

I know this has been done but wonder if anyone can help. I have a yarn store and sell patterns. I have the below code from a site called ravelry to it will take the customer to add the pattern they have bought to their raverly library (it is a knitting thing)

The code works great. What I am having trouble with it getting it only to appear if one of the items bought has download in the variant title or product title (could be multiple items to check, but only want the button to appear once.

If anyone has any ideas on how to do the for loop as we have tried loads of different options but nothing works.

So this is the code for the button which I know works…

Thank you so much of you can help.

Jamo

Hi @JamoDesigns

What do you mean by,

only want the button to appear once.

Can you clarify?

Hi thanks for responding.

Meant if the person had bought 4 patterns, don’t want the button to appear 4 times if in a loop.

Thanks,

Jamo

Request you to try with below code in the additional script.

{% for item in order.line_items %}
{% if item.title contains "download"  %}

{% endif %}
{% endfor %}

Hope this will help…

Hi thanks,

Sorry did not work. With liquid just wondering if the if will be case sensitive. Will do a few tests when I get some free time.

Thanks for your help.

Jamo

Let me know once you are done with your test.

We can fix this if want?

Hi Jamo,

In case you’re still looking for a solution, our digital products app - FileJar has as integration with Ravelry for that final step of displaying the “Add pattern to library” button both on the Thank You page and on the Order status page. The button only gets displayed once, even if multiple designs were purchased.

You can find it here:

https://apps.shopify.com/filejar