In a module under Magento 1.9. I was loading quote item option using

$_quoteOption = Mage::getModel('sales/quote_item_option')->load($Option_id);

I would like to do the same thing under magento2 but I do not manage to find which class / function to use (\Magento\Sales\Model\Quote\... does not exist)

I am in a controller triggered by a button in customer account order view

Any idea?


We can try with \Magento\Quote\Model\Quote\Item\Option class.

protected $quoteItemOption;

public function __construct(
    \Magento\Quote\Model\Quote\Item\OptionFactory $quoteItemOption
    $this->quoteItemOption = $quoteItemOption;

In your execute method, we can use $this->quoteItemOption->create()->load($optionId);

Currently, I cannot find another way, I tried with Factory and load way.

My Magento version is 2.1.5.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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