Magento 2.x – How to get product option value on an order item by option sku.


Hi there, hope your doing well and staying safe at home.

In this post, i’ll show you how to get a custom option value, iterating through order items, with the option sku.

First step, is having your option sku, that should be configured on the catalog product edit page, of your admin panel, like this:

 

Afterwards, the following snippet will help you, you will only need to pass as a parameter, the order id where the product has been purchased:


 

Hope it helps you.

Happy coding.!