the default Magento2 report from ordered products excludes orders with status canceled. I also want to exclude status closed.


in line 60 shows

  $connection->quoteInto("{$orderTableAliasName}.state <> ?", \Magento\Sales\Model\Order::STATE_CANCELED),

How can I add STATE_CLOSED here? I tried a bit but no success.

1 Answer 1


your condition should be in your case

    "{$orderTableAliasName}.state NOT IN (?)", 
  • Thank you, its working! Commented Mar 12, 2021 at 7:49
  • you are most welcome! :)
    – Diana
    Commented Mar 12, 2021 at 7:52

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.