replacing in liquid

Solved
Speedimize
Shopify Partner
213 35 91

This is an accepted solution.

Hi @Andre_Borges 

The error was that you can't reuse parentheses inside {{ }}.
Try the code below:

{% assign image = product.images[1] | img_url: 'large' %}
{% if product.media.size > 1 %}
{% capture image_html %}
  <img src="{{ image }}" alt="{{ product.featured_image.alt | escape  }}">
{% endcapture %}
{{ product_description | replace: 'Como Usar?', image_html }}
{% endif %}
We Speedimize your store
Have a problem with speed performance, send me email here: hello@speedimize.io


If our advice was helpful please LIKE or ACCEPT SOLUTION
r8r
Shopify Expert
1264 133 420

@r8r wrote:

@Andre_Borges Liquid doesn’t work like that - you’d have to capture the replace-string in a variable first. 


¯\_(ツ)_/¯

Mario Rader [he] ★ If you want to achieve greatness, stop asking for permission. ★ Studio Mitte
• Meine Antwort war hilfreich? Hinterlass bitte ein Like.
• Meine Antwort hat Dein Problem behoben? Bitte akzeptiere sie als Lösung.
• Ich hab dir etwas erspart? Ich freue ich mich immer über eine kleine Aufmerksamkeit
• Ja, ich biete Shopify-Services & -Entwicklung und freue mich von Dir zu hören!
• Bitte teile einen Link zu der Seite, deren Problem Du in deinem Beitrag beschreibst!

• Yes, I provide Shopify-services & -development. Feel free to get in touch!
• Please share a link to the site, which you refer to in your problem description. This incredibly increases the chances of you receiving a useful answer!
• My answer was useful? Please leave a Like.
• My answer solved your issue? Please accept it as the solution.
• I saved you time or money? I'm always happy to receive a little thank you.
0 Likes

@Speedimize 

This is it!!!

This was what was missing, thank you!!

Its working!

@r8r you need to look at yourself instead of saying "i told you so" with your last comment.

Answering "Liquid doesn’t work like that - you’d have to capture the replace-string in a variable first" to someone that is asking for help with liquid is not helpful at all!

Whats the point of saying stuff that wont help and then be pissed about it?

I was asking for help because i dont know.
But instead of understanding this obvious statement (the other doesnt know thats why he is asking for help), you prefer to be pissed about the other.
And you answer like I was making an effort to NOT understand you. When in reality i honestly didnt understand.

Also this last comment was not helpful. If its tedious to you why in the world are you here saying stuff?
"Debugging this without having the code to work with is pretty tedious though."

Plus if there were some "code to work" missing how could Speedimize help?

c'mon

 

 

 

0 Likes
r8r
Shopify Expert
1264 133 420

Not sure why you're getting worked up like this – in my view, you were out of line with this response:


@Andre_Borges wrote:

That wasnt very helpful

What do you mean its your code? Its nothing like your code. It has liquid inside the img.

I'm not here to teach people netiquette – you got what you needed:
good that @Speedimize translated what I wrote into code you could use.


 

Mario Rader [he] ★ If you want to achieve greatness, stop asking for permission. ★ Studio Mitte
• Meine Antwort war hilfreich? Hinterlass bitte ein Like.
• Meine Antwort hat Dein Problem behoben? Bitte akzeptiere sie als Lösung.
• Ich hab dir etwas erspart? Ich freue ich mich immer über eine kleine Aufmerksamkeit
• Ja, ich biete Shopify-Services & -Entwicklung und freue mich von Dir zu hören!
• Bitte teile einen Link zu der Seite, deren Problem Du in deinem Beitrag beschreibst!

• Yes, I provide Shopify-services & -development. Feel free to get in touch!
• Please share a link to the site, which you refer to in your problem description. This incredibly increases the chances of you receiving a useful answer!
• My answer was useful? Please leave a Like.
• My answer solved your issue? Please accept it as the solution.
• I saved you time or money? I'm always happy to receive a little thank you.
0 Likes