liquid
liquid copied to clipboard
Paginate object not working properly when use with customer.orders in test mode
Current problem
https://shopify.dev/docs/themes/liquid/reference/objects/paginate#paginate-items
The paginate object total of items ({{ paginate.items }}) is not returning the real total of the object passed. The issue only happens when the object passed is customer.orders and the orders were submitted using the bogus payment method.
{% paginate customer.orders by 20 %}
Orders created by duplicating another order are counted
only if they are marked as paid or pending
Test example
The following test example was made using the default Debug theme that gets added when creating a new store.
The orders 1010, 1011, 1012, 1013 and 1014 were created in the frontend using the Bogus payment method to complete the transaction.
The order 1015 was created by duplicating the order 1014 and marking it as paid.
The next image is from the /account page, I've edited the liquid code and added some code to display the customer.orders.size value and the paginate.items value:
Note that the total orders here are 6 but paginate is only displaying 1 as total items. The 1 is related to the order 1015 that was the only that Shopify didn't mark as test order in the backend. The other orders, because they were made using the bogus payment method were marked as test orders:
Continuing, I added order 1016 by duplicating and order and marking it as paid in the backend. The order 1019 was also created by duplicating the order 1016 but using the Bogus payment method in the backend. The result, only the orders 1015 and 1016 are counted by the paginate object
Editing the Debug theme files and modifying the paginate object code in customers/account.liquid line 11
From:
{% paginate customer.orders by 20 %}
to
{% paginate customer.orders by 2 %}
Checking the /account page, there are only 2 orders as that is what paginate detects. We know that they are 8 orders in total and we are expecting to see a pagination to see the rest:
Updating the code again, and setting the paginate size to 1 order per page:
{% paginate customer.orders by 1 %}
We can now see the pagination appearing on the page, However we can only browse to page 2:
Now I've set the paginate page size to 5
{% paginate customer.orders by 5 %}
The result, we only see 5 orders displayed and no pagination shown:
But we can manually change the url and set the page=2, then we see the missing orders:
Expected behaviour
paginate.items should return the same number as the object passed as per documentation. There should not be any extra validation on type of payment.
In this particular case, the object passed is customer.orders and as per image 3, the object size is 6 and the expected value in paginate.items is 6 and not 2.
In case there is any reason to keep this behaviour, I would recommend an update to the documentation here: https://shopify.dev/docs/themes/liquid/reference/objects/paginate#paginate-page_size https://shopify.dev/docs/themes/liquid/reference/tags/theme-tags/#paginate https://shopify.dev/docs/themes/files/customers-account-liquid
And include a note like these ones to alter other developers of this specific behaviour:
Steps to replicate
1- In any Shopify store, create a customer account. 2- Make some orders using the Bogus payment method. (Suggested 3 orders) 3- Create some from the backend by duplicating an existing order or creating one from draft and assign it to the same customer. (Suggested 3 orders). 4- Login as the customer and go to the /account link 5- Play with the paginate code, in any theme locate the customers/account.liquid file and edit the line that paginate the orders.
I hope this is the right place to report this issue, if no please help me out to get this to the right place.
@shopify-admins please help us
Still an issue at this time.
Does anyone have workaround solution for that issue?
Any progress on this issue?
Hitting this issue as well.
I am getting the same issue. Please let us know if you have resolved this issue or any updates on this. Thank you!
the same issue on my store.
Same issue here.
To me it seems like it filters out the unfulfilled orders.
An additional filter to use with paginate theme tag to include or exclude orders status would be great. 🙏
Same issue here, on Dawn theme.
Same issue here, on both dawn and custom themes. The paginate object returns the wrong values when printed through the console (console.log({{ paginate | json }})):
current_offset: 0
current_page: 1
items: 0
page_size: 4
pages: 1
parts: Array(0)
Based on my orders, it should have returned:
current_offset: 0
current_page: 1
items: 6
next: {...}
page_size: 4
pages: 2
parts: Array(2)
The same code returns the correct JSON for orders created through the Shopify admin using manual payment.
Still a problem in July 2023