How to push array data customer order and filter by status?

Highlighted
New Member
5 0 0

I want to show confirm button on my customer account page If status order is Pending and this is my code showing confirm button

{% capture products_list %}
   {% for order in customer.orders %}
      {% assign status_note = order.financial_status | ',' %}
      {% include 'dump' with status_note %}
   {% endfor %}
{% endcapture %}
{% assign status_all = products_list | ','%}
{% if status_all contains "pending" %}
      <button class="btn btn-default" id="id_confirm" onclick="window.location='/confirm'" >Confirm
      </button>
{% endif %}

that code is working but I think it not effective to do because When I want to call ' status_note' outside of looping I only get last data array. NOT all data push in array. you can chek link: https://www.screencast.com/t/5qRHgolsG

Thank you

0 Likes