How to add formatting in order notes for a custom plugin?

How to add formatting in order notes for a custom plugin?

nicksrc
Visitor
2 0 2

Hi I'm making a plugin and I'm using this API to add notes to orders: https://help.shopify.com/en/api/reference/orders/order#update-2019-07

 

I was wondering if there is any way to add some formatting to the note so I can do something like this:

 

Key: Value,

Key: Value,

Key: Value,

 

Rather than Key: Value, Key: Value, Key: Value,

 

I tried the note attributes, but that is visible to the customer and we don't want this to be visible to the customer. Thanks!

Replies 4 (4)

CloudPlug24
Shopify Partner
1 0 0

Hi @nicksrc , You just need to be pass \r\n on your content , to manage data on next line. hope it will helpful for you.

 

Thanks

Fabien_Sebban
Shopify Partner
45 0 19

Hi @CloudPlug24 ,

This solution does not work for me. Do you know another way to do this?

 

Thanks

Fabien_Sebban
Shopify Partner
45 0 19

I could handle this by removing an hyphen in my for loop :

 

{%- for lineItems_item in order.lineItems -%}
  {%- for metafields_item in lineItems_item.variant.metafields -%}
    {%- if metafields_item.namespace == 'namespace' and metafields_item.key == 'key' %}
      {{ lineItems_item.variant.sku }} : {{ metafields_item.value }}
    {%- endif -%}
  {%- endfor -%}
{%- endfor %}

 The if statement has no hyphen at the end to add a breaking line at the end of each line.

aatbump
Tourist
3 0 1

Order Notes

 

How would this be edited to replace ## with a line break?