Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ListTable::months_filter should filter order dates by order type #47406

Closed
5 tasks
gedex opened this issue May 13, 2024 · 0 comments · Fixed by #47440
Closed
5 tasks

ListTable::months_filter should filter order dates by order type #47406

gedex opened this issue May 13, 2024 · 0 comments · Fixed by #47440
Labels
focus: order Issues related to orders. team: Proton type: bug The issue is a confirmed bug.

Comments

@gedex
Copy link
Member

gedex commented May 13, 2024

Prerequisites

  • I have carried out troubleshooting steps and I believe I have found a bug.
  • I have searched for similar bugs in both open and closed issues and cannot find a duplicate.

Describe the bug

This query that list order dates

$order_dates = $wpdb->get_results(
"
SELECT DISTINCT YEAR( t.date_created_local ) AS year,
MONTH( t.date_created_local ) AS month
FROM ( SELECT DATE_ADD( date_created_gmt, INTERVAL $utc_offset SECOND ) AS date_created_local FROM $orders_table WHERE status != 'trash' ) t
ORDER BY year DESC, month DESC
"
);

is missing a filter of order type. This makes all order types have the same dates dropdown.

Expected behavior

If two order types have different min and max of date_created orders, they should render dates dropdown differently

Actual behavior

Both order types get the same dates dropdown

Steps to reproduce

  • Create two test orders with different created months
  • Create a subscription (or any order type) with any created month

See the months dropdown are the same:

image

WordPress Environment

Latest

Isolating the problem

  • I have deactivated other plugins and confirmed this bug occurs when only WooCommerce plugin is active.
  • This bug happens with a default WordPress theme active, or Storefront.
  • I can reproduce this bug consistently using the steps above.
@gedex gedex added the type: bug The issue is a confirmed bug. label May 13, 2024
@lanej0 lanej0 added focus: order Issues related to orders. team: Proton labels May 13, 2024
gedex added a commit that referenced this issue May 14, 2024
The query was missing a filter to order type.

Fixes #47406.
gedex added a commit that referenced this issue May 14, 2024
The query was missing a filter to order type.

Fixes #47406.
jorgeatorres pushed a commit that referenced this issue May 14, 2024
The query was missing a filter to order type.

Fixes #47406.
jorgeatorres pushed a commit that referenced this issue May 14, 2024
The query was missing a filter to order type.

Fixes #47406.
jorgeatorres pushed a commit that referenced this issue May 14, 2024
The query was missing a filter to order type.

Fixes #47406.
jorgeatorres pushed a commit that referenced this issue May 14, 2024
* Fix dates dropdown in admin list order page

The query was missing a filter to order type.

Fixes #47406.

* Fix changelog header
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
focus: order Issues related to orders. team: Proton type: bug The issue is a confirmed bug.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants