Skip to content

Rendering order as json in liquid creates invalid json for discount_applications if > 1 discount #1972

Description

@shawngrona

steps to reproduce:

  1. establish a customer with an order with more than one discount applications
  2. render orders as json as per the following
<script class="json-customer-api-response" type="application/json">
{
  "moneyFormat": {{ shop.money_format | json }},
  "ordersCount": {{ customer.orders_count | json }},
  "orders":
  {%- paginate customer.orders by 20 -%}
    {
      "currentPage": {{ paginate.current_page | json }},
      "pageCount": {{ paginate.pages | json }},
      "nodes": [
        {%- for order in customer.orders -%}
          {%- render 'customer-api-order', order: order -%}
          {%- unless forloop.last %},{% endunless %}
        {% endfor -%}
      ]
    }
  {%- endpaginate -%}
}
</script>

expected:
orders render with proper json

actual:
discount_applications renders an array that is not comma-delimited eg

 [{
        "title": "discount applied",
        "total_allocated_amount": 0
      }{
        "title": "Bundle Upgrade",
        "total_allocated_amount": 37000
      }]

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions