1

I have a code to get a selected custom option values on cart page.But suppose cart item has custom options which are not required.So in this case if customer add this product to the cart but without selecting any custom options.

So now I want to know that on cart page,whether customer select any custom option or not.

I am getting an selected option using code :

$item->getBuyRequest()->getData('options');

But when customer does not select any option that time I am getting blank array like :

Array
(
  [48] => 
)

Please help me.

  • are you need any msg or log? – Abdul Jan 12 '16 at 7:22
  • I am putting this in If condition. – Poyan Jan 12 '16 at 8:45
  • Try this : $option = $item->>getOptionByCode('info_buyRequest'); – Abdul Jan 12 '16 at 9:13
1

I found a solution by using this:

$item->getOptionByCode('option_ids');

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.