Ability to provide file content directly in _additional_files.json
You can now pass content for an additional file directly inside _additional_files.json instead of providing a URL to fetch the file from. To do that use content inside the source field:
[
{
"destination": myfile.txt,
"source": {
"content": "Content for myfile.txt!"
}
}
]An example use-case is when you need to create a separate job ticket file for each orderline in the order.
Liquid’s
capturetogether with theescape_jsonfilter can be useful when generated file content needs to be more complex:[ {% for line in orderlines %} {% capture file_content %} Content with newlines and liquid code: {{ line.barcode }} {% endcapture %} { "destination": myfile.txt, "source": { "content": "{{ file_content | escape_json }}" } }{% unless forloop.last %},{% endunless %} {% endfor %} ]
Example to add file_upload type Variants into a folder on the FTP.
Last updated