I need to add a function which will be check order state in JS for show/hide content in rows in Orders (Admin Panel).

In php I can use something like Order:STATE_COMPLETE, but in JS I don't know how to get this.

  • Sorry,donot understood your point
    – Amit Bera
    Commented Sep 21, 2017 at 14:08

1 Answer 1


You can't do this directly from JS. The JS framework of Magento 2 does not have any knowledge of database information, unless you toss the information to your JS or template. What you could do it collect the data in PHP, and add it to your block so you can use it in your template. Or you could do an Ajax call to your server when you need the data.

  • Ok, I have used variables: var STATE_CANCELED = 'canceled'; Commented Sep 21, 2017 at 14:47

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.