Error when replacing order.total_price with order.current_total_price

Solved
samddc
Tourist
4 0 0

Right now the code below fills in a table that displays all orders placed by my customers on their member dashboard. When a manual change is made to replace one item with another the price column displays the total for both items even though one has been removed. This is because order.total_price is being called instead of order.current_total_price. When I make the change in the code nothing shows up in the table. I've attempted this with multiple other order attributes with the same result. No error is generated but the column shows up as blank. 

{%- if customer.orders.size == 0 -%}
          <p>{{ 'customer.account.no_orders' | t }}</p>
          <a href="/" class="button button--primary">{{ 'customer.account.start_shopping' | t }}</a>
        {%- else -%}
          {%- paginate customer.orders by 50 -%}
            <table class="table table--responsive">
              <thead>
                <tr>
                  <th>{{ 'customer.orders.order_number' | t }}</th>
                  <th>{{ 'customer.orders.date' | t }}</th>
                  <th>{{ 'customer.orders.payment_status' | t }}</th>
                  <th>{{ 'customer.orders.fulfillment_status' | t }}</th>
                  <th class="table--align-right">{{ 'customer.orders.total' | t }}</th>
                </tr>
              </thead>

              <tbody>
                {%- for order in customer.orders -%}
                  <tr>
                    <td data-label="{{ 'customer.orders.order_number' | t }}"><a href="{{ order.customer_url }}" class="link link--primary">{{ order.name }}</a></td>
                    <td data-label="{{ 'customer.orders.date' | t }}">{{ order.created_at | date: format: 'month_day_year' }}</td>
                    <td data-label="{{ 'customer.orders.payment_status' | t }}">{{ order.financial_status_label }}</td>
                    <td data-label="{{ 'customer.orders.fulfillment_status' | t }}">{{ order.fulfillment_status_label }}</td>
                    <td class="table--align-right" data-label="{{ 'customer.orders.total' | t }}">{{ order.total_price | money }}</td>
                  </tr>
                {%- endfor -%}
              </tbody>
            </table>

 

0 Likes
Ninthony
Shopify Partner
1798 260 708

I don't quite understand what you mean by a manual change is made to replace one item with another. There is no property for current_total_price on the order object, so it's going to return nothing. Some screenshots showcasing the issue would help. Here's the order object and a list of it's properties you can call:

https://shopify.dev/docs/themes/liquid/reference/objects/order 

If my solution helped you, please like and accept as solution!
If you'd like to make any edits to your store, please send me a personal message and we can discuss what you'd like to accomplish :D
samddc
Tourist
4 0 0

I was under the assumption that I could call anything from the Shopify API but I see this is not the case.

For example in the order below one product is removed and one added. The total should be $395.11 but instead order.total_price returns $790.22. In the API order.total_price also returns $790.22 but I can call order.current_total_price which returns the correct amount of $395.11. This appears to be a Shopify issue since the change displays properly on the web interface but doesn't in the liquid object. 

Screen Shot 2021-04-30 at 1.25.04 PM.png

0 Likes
Ninthony
Shopify Partner
1798 260 708

Oh okay, so you removed it on the order itself and you're saying it's still returning you information based on the initial order in your liquid file. Hm, that's interesting I haven't encountered this issue before. Did you refund that portion of the order? There's a order.total_refunded_amount property. You could make a check to see if it's greater than 0 and if it is, subtract it from the total_price. Also there's a order.transaction property that returns an array of all transactions for the order, maybe the information you need will be in there.

If my solution helped you, please like and accept as solution!
If you'd like to make any edits to your store, please send me a personal message and we can discuss what you'd like to accomplish :D
0 Likes
samddc
Tourist
4 0 0

No refund just a manual edit. Add one item and remove another. I may be able to work around the issue using transaction properties this seems to me like something that needs to be fixed.

Should I create a Github issue/pr and if so can you direct me to the best place to do so?

0 Likes
Ninthony
Shopify Partner
1798 260 708

This is an accepted solution.

Haven't the faintest idea. You can report the issue here:

https://help.shopify.com/en/questions

 

I don't know how helpful that will be honestly, Shopify isn't super responsive with this kind of stuff. They've had "features" on their docket for years. Maybe they can point you in the right direction though.

If my solution helped you, please like and accept as solution!
If you'd like to make any edits to your store, please send me a personal message and we can discuss what you'd like to accomplish :D