0

I want to get selected associated product information from configurable product after an checkout_cart_add_after triggered. I'll look after it in mean time,if any helps would be appreciable.

1 Answer 1

4

Add below code in your observer file

$item = $observer->getQuoteItem();

$product = $item->getProduct();
$typeId = $product->getTypeId();
if ($typeId == \Magento\ConfigurableProduct\Model\Product\Type\Configurable::TYPE_CODE) {

    $attributes = $product->getTypeInstance()->getSelectedAttributesInfo($product);
}
1
  • Thank you so much for the reply it returns the selected options attribute information and also how do I get the associated product id or other attributes like price. Oct 12, 2018 at 7:16

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.