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

Unable to retrieve comments on Orders/Shipments/Invoices #39630

Open
1 of 5 tasks
paales opened this issue Feb 14, 2025 · 3 comments
Open
1 of 5 tasks

Unable to retrieve comments on Orders/Shipments/Invoices #39630

paales opened this issue Feb 14, 2025 · 3 comments
Assignees
Labels
Issue: needs update Additional information is require, waiting for response Reported on 2.4.7 Indicates original Magento version for the Issue report.

Comments

@paales
Copy link
Contributor

paales commented Feb 14, 2025

Preconditions and environment

  • 2.4.7

Steps to reproduce

  1. Create an order for a customer.
  2. Add a comment in the backend on the order and have 'Visible on Storefront' checked.
  3. Create an invoice
  4. Create a comment on the invoice with 'Visible on Storefront' checked.
  5. Create a shipment
  6. Create a comment on the shipment with 'Visible on Storefront' checked.
  7. Create a credit memo
  8. Create a comment on the credit memo with 'Visible on Storefront' checked.
  9. Run the following query
query GetOrder($orderNumber:String!){
  customer {
    orders(filter:{number:{eq: $orderNumber}}) {
      items {
        number
        comments {
          message
          timestamp
        }
        invoices {
          number
          comments {
            message
            timestamp
          }
        }
        shipments {
          number
          comments {
            message
            timestamp
          }
        }
        credit_memos {
          number
          comments {
            message
            timestamp
          }
        }
      }
    }
  }
}

Make sure you have given the correct order number that you placed, so pass variables:

{
  "orderNumber": "YOUR ORDER NUMBER HERE"
}

Also make sure you have the correct headers (replace the values with the correct values):

{
  "Store":"STORE CODE THE ORDER WAS PLACED",
  "Authorization": "Bearer LOGGED IN BEARER TOKEN"
}

Expected result

I would expect customer.orders.items.0.comments to be an array
I would expect customer.orders.items.0.comments.0 to have a value
I would expect customer.orders.invoices.0.comments.0 to have a values
I would expect customer.orders.shipments.0.comments.0 to have a values

Actual result

{
  "data": {
    "customer": {
      "orders": {
        "items": [
          {
            "number": "3000000977",
            "comments": null,
            "invoices": [
              {
                "number": "3000000196",
                "comments": []
              }
            ],
            "shipments": [
              {
                "number": "3000000003",
                "comments": []
              }
            ],
            "credit_memos": [
              {
                "number": "3000000002",
                "comments": [
                  {
                    "message": "Tallalala",
                    "timestamp": "2025-02-14 13:25:00"
                  }
                ]
              }
            ]
          }
        ]
      }
    }
  },
}

Additional information

Credit memo has a resolver (so that one works):

type CreditMemo @doc(description: "Contains credit memo details.") {
id: ID! @doc(description: "The unique ID for a `CreditMemo` object.")
number: String! @doc(description: "The sequential credit memo number.")
items: [CreditMemoItemInterface] @doc(description: "An array containing details about refunded items.") @resolver(class: "Magento\\SalesGraphQl\\Model\\Resolver\\CreditMemo\\CreditMemoItems")
total: CreditMemoTotal @doc(description: "Details about the total refunded amount.") @resolver(class: "Magento\\SalesGraphQl\\Model\\Resolver\\CreditMemo\\CreditMemoTotal")
comments: [SalesCommentItem] @doc(description: "Comments on the credit memo.") @resolver(class: "Magento\\SalesGraphQl\\Model\\Resolver\\CreditMemo\\CreditMemoComments")
}

Order has no resolver for comments:

type CustomerOrder @doc(description: "Contains details about each of the customer's orders.") {
id: ID! @doc(description: "The unique ID for a `CustomerOrder` object.")
order_date: String! @doc(description: "The date the order was placed.")
status: String! @doc(description: "The current status of the order.")
number: String! @doc(description: "The order number.")
items: [OrderItemInterface] @doc(description: "An array containing the items purchased in this order.") @resolver(class: "Magento\\SalesGraphQl\\Model\\Resolver\\OrderItems")
total: OrderTotal @doc(description: "Details about the calculated totals for this order.") @resolver(class: "Magento\\SalesGraphQl\\Model\\Resolver\\OrderTotal")
invoices: [Invoice]! @doc(description: "A list of invoices for the order.") @resolver(class: "Magento\\SalesGraphQl\\Model\\Resolver\\Invoices")
shipments: [OrderShipment] @doc(description: "A list of shipments for the order.") @resolver(class: "Magento\\SalesGraphQl\\Model\\Resolver\\Shipments")
credit_memos: [CreditMemo] @doc(description: "A list of credit memos.") @resolver(class: "Magento\\SalesGraphQl\\Model\\Resolver\\CreditMemos")
payment_methods: [OrderPaymentMethod] @doc(description: "Payment details for the order.")
shipping_address: OrderAddress @doc(description: "The shipping address for the order.")
billing_address: OrderAddress @doc(description: "The billing address for the order.")
carrier: String @doc(description: "The shipping carrier for the order delivery.") @resolver(class: "Magento\\SalesGraphQl\\Model\\Resolver\\CustomerOrders\\Carrier")
shipping_method: String @doc(description: "The delivery method for the order.")
comments: [SalesCommentItem] @doc(description: "Comments about the order.")
increment_id: String @deprecated(reason: "Use the `id` field instead.")
order_number: String! @deprecated(reason: "Use the `number` field instead.")
created_at: String @deprecated(reason: "Use the `order_date` field instead.")
grand_total: Float @deprecated(reason: "Use the `totals.grand_total` field instead.")
token: String! @doc(description: "The token that can be used to retrieve the order using order query.") @resolver(class: "Magento\\SalesGraphQl\\Model\\Resolver\\Token")
applied_coupons: [AppliedCoupon!]! @doc(description: "Coupons applied to the order.")
email: String @doc(description: "Order customer email.")
is_virtual: Boolean! @doc(description: "`TRUE` if the order is virtual") @resolver(class: "Magento\\SalesGraphQl\\Model\\Resolver\\OrderIsVirtual")
available_actions: [OrderActionType!]! @doc(description: "List of available order actions.") @resolver(class: "\\Magento\\SalesGraphQl\\Model\\Resolver\\OrderAvailableActions")
customer_info: OrderCustomerInfo! @doc(description: "Returns customer information from order.") @resolver(class: "Magento\\SalesGraphQl\\Model\\Resolver\\OrderCustomerInfo")
order_status_change_date: String! @doc(description: "The date the order status was last updated.") @resolver(class: "Magento\\SalesGraphQl\\Model\\Resolver\\OrderStatusChangeDate")
}

Invoice:

type Invoice @doc(description: "Contains invoice details.") {
id: ID! @doc(description: "The unique ID for a `Invoice` object.")
number: String! @doc(description: "Sequential invoice number.")
total: InvoiceTotal @doc(description: "Invoice total amount details.") @resolver(class: "Magento\\SalesGraphQl\\Model\\Resolver\\Invoice\\InvoiceTotal")
items: [InvoiceItemInterface] @doc(description: "Invoiced product details.") @resolver(class: "Magento\\SalesGraphQl\\Model\\Resolver\\Invoice\\InvoiceItems")
comments: [SalesCommentItem] @doc(description: "Comments on the invoice.")
}

Shipment:

type OrderShipment @doc(description: "Contains order shipment details.") {
id: ID! @doc(description: "The unique ID for a `OrderShipment` object.")
number: String! @doc(description: "The sequential credit shipment number.")
tracking: [ShipmentTracking] @doc(description: "An array of shipment tracking details.") @resolver(class: "Magento\\SalesGraphQl\\Model\\Resolver\\Shipment\\ShipmentTracking")
items: [ShipmentItemInterface] @doc(description: "An array of items included in the shipment.") @resolver(class: "Magento\\SalesGraphQl\\Model\\Resolver\\Shipment\\ShipmentItems")
comments: [SalesCommentItem] @doc(description: "Comments added to the shipment.")
}

Release note

GraphQ: While quering for comments on orders, shipments or invoices it would return en empty array, now it returns the actual comments.

Triage and priority

  • Severity: S0 - Affects critical data or functionality and leaves users without workaround.
  • Severity: S1 - Affects critical data or functionality and forces users to employ a workaround.
  • Severity: S2 - Affects non-critical data or functionality and forces users to employ a workaround.
  • Severity: S3 - Affects non-critical data or functionality and does not force users to employ a workaround.
  • Severity: S4 - Affects aesthetics, professional look and feel, “quality” or “usability”.
Copy link

m2-assistant bot commented Feb 14, 2025

Hi @paales. Thank you for your report.
To speed up processing of this issue, make sure that the issue is reproducible on the vanilla Magento instance following Steps to reproduce.


Join Magento Community Engineering Slack and ask your questions in #github channel.
⚠️ According to the Magento Contribution requirements, all issues must go through the Community Contributions Triage process. Community Contributions Triage is a public meeting.
🕙 You can find the schedule on the Magento Community Calendar page.
📞 The triage of issues happens in the queue order. If you want to speed up the delivery of your contribution, join the Community Contributions Triage session to discuss the appropriate ticket.

@engcom-Delta engcom-Delta self-assigned this Feb 14, 2025
Copy link

m2-assistant bot commented Feb 14, 2025

Hi @engcom-Delta. Thank you for working on this issue.
In order to make sure that issue has enough information and ready for development, please read and check the following instruction: 👇

  • 1. Verify that issue has all the required information. (Preconditions, Steps to reproduce, Expected result, Actual result).
  • 2. Verify that issue has a meaningful description and provides enough information to reproduce the issue.
  • 3. Add Area: XXXXX label to the ticket, indicating the functional areas it may be related to.
  • 4. Verify that the issue is reproducible on 2.4-develop branch
    Details- If the issue is reproducible on 2.4-develop branch, please, add the label Reproduced on 2.4.x.
    - If the issue is not reproducible, add your comment that issue is not reproducible and close the issue and stop verification process here!
  • 5. Add label Issue: Confirmed once verification is complete.
  • 6. Make sure that automatic system confirms that report has been added to the backlog.

@engcom-Delta engcom-Delta added the Reported on 2.4.7 Indicates original Magento version for the Issue report. label Feb 14, 2025
@engcom-Delta
Copy link
Contributor

Hi @paales ,

Thanks for your reporting and collaboration.
We have tried to reproduce the issue again in Latest 2.4-develop instance and we are not able to reproduce the issue.Kindly refer the screenshot.

Steps to reproduce :

  1. Create an order for a customer.
  2. Add a comment in the backend on the order and have 'Visible on Storefront' checked.
  3. Create an invoice
  4. Create a comment on the invoice with 'Visible on Storefront' checked.
  5. Create a shipment
  6. Create a comment on the shipment with 'Visible on Storefront' checked.
  7. Create a credit memo
  8. Create a comment on the credit memo with 'Visible on Storefront' checked.
  9. Run the following query
    Observe the response, comments are displaying as expected

Image
{
"data": {
"customer": {
"orders": {
"items": [
{
"number": "000000001",
"comments": [
{
"message": "Test Comment 1",
"timestamp": "2025-02-17 12:54:36"
}
],
"invoices": [
{
"number": "000000001",
"comments": [
{
"message": "Test Comment 2",
"timestamp": "2025-02-17 06:55:29"
}
]
}
],
"shipments": [
{
"number": "000000001",
"comments": [
{
"message": "Test Comment 3",
"timestamp": "2025-02-17 07:00:34"
}
]
}
],
"credit_memos": [
{
"number": "000000001",
"comments": [
{
"message": "Test Comment 4",
"timestamp": "2025-02-17 07:01:58"
}
]
}
]
}
]
}
}
}
}

Kindly recheck the issue in Latest 2.4-develop instance and elaborate the steps to reproduce if the issue is still reproducible.

Thanks.

@engcom-Delta engcom-Delta added the Issue: needs update Additional information is require, waiting for response label Feb 17, 2025
@github-project-automation github-project-automation bot moved this to Ready for Confirmation in Issue Confirmation and Triage Board Feb 17, 2025
@engcom-Delta engcom-Delta moved this from Ready for Confirmation to Needs Update in Issue Confirmation and Triage Board Feb 17, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Issue: needs update Additional information is require, waiting for response Reported on 2.4.7 Indicates original Magento version for the Issue report.
Projects
Development

No branches or pull requests

2 participants