I used this event in Magento 1:- sales_quote_config_get_product_attributes.

In Magento 2 this event is removed, in CHANGELOG.md it's saying, use plugin instead of event.

How can i use this event as plugin in Magento 2?


The event was used to modify the return value of Mage_Sales_Model_Quote_Config::getProductAttributes()

This is now possible with an after plugin.

The class is now Magento\Quote\Model\Quote\Config, the method still getProductAttributes()

Plugins are documented here: http://devdocs.magento.com/guides/v2.0/extension-dev-guide/plugins.html


You can see the existing code like


<type name="Magento\Quote\Model\Quote\Config">
    <plugin name="append_sales_rule_keys_to_quote" type="Magento\SalesRule\Model\Plugin\QuoteConfigProductAttributes"/>


public function afterGetProductAttributes(\Magento\Quote\Model\Quote\Config $subject, array $attributeKeys)
    $attributes = $this->_ruleResource->getActiveAttributes();
    foreach ($attributes as $attribute) {
        $attributeKeys[] = $attribute['attribute_code'];
    return $attributeKeys;

You can use like this in Plugin way ( Before, After and Around ) in your module. I hope you know how to create a basic plugin flow.

Hope this helps.

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.