Encode string to base64 into the email template

Hello!

How can I encode a string into the email template to base64?
What I want is to achive the fallow results:
[www.link.com/encoded order.email]

The js solution can be like this: link

Is anything that can be done? a custom filter? snippet? api? :slight_smile:

Thank you for your time!

Does it need to be 2-way? If not, you have string encryption filters in Liquid.

Thank you for your answer!
no, it not need to be “2 way”, but needs to be encoded to base64

The filters are for encryption (md5, sha1 … )

I try to implement the rating button in to email template from https://www.trustedshops.de

Yep, that’s why I was asking whether it needs to be 2-way. If not you can use weak encryption such as MD5. But you say you have to use base64 regardless so that rules out the string filters.

Not aware of anything doable in Shopify Liquid. But hey, who knows - seen JSON parsers written in Liquid!!! ?

:slight_smile:
Thank you!
ahh… will be a long night! ^^

adding in here for reference just in case anyone else ends up here in this obscure corner of the shopify forum - you 100% can encode to base64 in liquid using base64_encode so the above accepted answer not correct.

{% capture test_string %}happy christmas{% endcapture%}
{{ test_string | base64_encode }}

working in order printer app and order emails for me.
apparently you can use | base64_decode for also but not tested.
only time I’ve been asked in like 10 years so not a common one.