Skip to content

[Issue] magento/magento2#37803: Customer order filters graphql #38371

Closed
@m2-assistant

Description

@m2-assistant

This issue is automatically created based on existing pull request: #38079: #37803: Customer order filters graphql


Description (*)

Fixed Issue

  1. Fixes customer order filters graphql #37803

Manual testing scenarios (*)

1.Create a new Module CustomerOrder.
2.Create a schema.graphqls in Teeela/CustomerOrder/etc/ folder to extend the CustomerOrderFilterInput.
Put following codes in this file:

input CustomerOrdersFilterInput @doc(description: "Identifies the filter to use for filtering orders.") {
number: FilterStringTypeInput @doc(description: "Filters by order number.")
created_at: FilterRangeTypeInput @doc(description: "Filters by created at.")
status: FilterEqualTypeInput @doc(description: "Filters by status.")
}

input FilterRangeTypeInput @doc(description: "Defines a filter that matches a range of values, such as prices or dates.") {
from: String @doc(description: "The beginning of the range")
to: String @doc(description: "The end of the range")
}

input FilterEqualTypeInput @doc(description: "Defines a filter that matches the input exactly.") {
in: [String] @doc(description: "An array of values to filter on")
eq: String @doc(description: "A string to filter on")
}
3.Use the following payload and {{your URL}}/graphql to query the customer token.

mutation {
generateCustomerToken(email: "{{your email address}}", password: "{{your password}}") {
token
}
}
4.Put above token in Postman Headers Authorization with Bearer {{your token}}.
5.Use following payload to query the above customer's sales orders.

query {
customer {
orders(filter: { created_at: { from: "2023-07-22" } status:{ in:["Processing"]} })
{
items {
number
created_at
}
}
}


Result:
orders from 2023-07-22 and status Processing

### Contribution checklist (*)
 - [ ] Pull request has a meaningful description of its purpose
 - [ ] All commits are accompanied by meaningful commit messages
 - [ ] All new or changed code is covered with unit/integration tests (if applicable)
 - [ ] README.md files for modified modules are updated and included in the pull request if any [README.md predefined sections](https://github.com/magento/devdocs/wiki/Magento-module-README.md) require an update
 - [ ] All automated tests passed successfully (all builds are green)

Metadata

Metadata

Assignees

No one assigned

    Labels

    Priority: P2A defect with this priority could have functionality issues which are not to expectations.Progress: done

    Type

    No type

    Projects

    Status

    Done

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions