Magento 2 Event Cheat Sheet

Event-observer is a importance part for Magento.Magento uses event hooking system heavily, following the Observer Design Pattern, which allows dditional functionality to be hooked in and out without modifying the core code.

Below is the list of events directly from the Magento codebase. It’s pretty unlikely that anything was missed but if you do notice something then let me know.

EventnameFilepath
wishlist_add_itemvendor\magento\module-wishlist\Model\ Wishlist.php
wishlist_product_add_aftervendor\magento\module-wishlist\Model\ Wishlist.php
rss_wishlist_xml_callbackvendor\magento\module-wishlist\Model\Rss\Wishlist.php
wishlist_item_collection_products_after_loadvendor\magento\module-wishlist\Model\ResourceModel\Item\Collection.php
wishlist_items_renewedvendor\magento\module-wishlist\Helper\Data.php
wishlist_update_itemvendor\magento\module-wishlist\Controller\Index\UpdateItemOptions.php
wishlist_sharevendor\magento\module-wishlist\Controller\Index\Send.php
wishlist_add_productvendor\magento\module-wishlist\Controller\Index\Add.php
product_option_renderer_initmodule-wishlist\Block\Customer\Wishlist\Item\Options.php
‘payment_method_assign_data_vault_’. $this->getProviderCode()vendor\magento\module-vault\Model\Method\Vault.php
payment_method_assign_data_vaultvendor\magento\module-vault\Model\Method\Vault.php
admin_user_authenticate_aftervendor\magento\module-user\Model\User.php
admin_user_authenticate_aftervendor\magento\module-user\Model\User.php
admin_user_authenticate_beforevendor\magento\module-user\Model\User.php
admin_permissions_role_prepare_saveVendor\magento\module-user\Controller\Adminhtml\User\Role\SaveRole.php
permissions_role_html_beforevendor\magento\module-user\Block\Role.php
adminhtml_cache_flush_systemVendor\magento\magento\module-translation\Model\Inline\CacheManager.php
admin_system_config_changed_section_designvendor\magento\module-theme\Model\Design\Config\Plugin.php
admin_system_config_changed_section_designvendor\magento\module-theme\Model\Design\Config\Plugin.php
assign_theme_to_stores_aftervendor\magento\module-theme\Model\Config.php
page_block_html_topmenu_gethtml_aftervendor\magento\module-theme\Block\Html\Topmenu.php
page_block_html_topmenu_gethtml_beforevendor\magento\module-theme\Block\Html\Topmenu.php
tax_settings_change_aftervendor\magento\module-tax\Model\Calculation\Rule.php
tax_settings_change_aftervendor\magento\module-tax\Model\Calculation\Rule.php
tax_settings_change_aftervendor\magento\module-tax\Model\Calculation\Rate.php
tax_settings_change_aftervendor\magento\module-tax\Model\Calculation\Rate.php
tax_settings_change_aftervendor\magento\module-tax\Model\Calculation\Rate.php
tax_rate_data_fetchvendor\magento\module-tax\Model\Calculation.php
adminhtml_cache_refresh_typevendor\magento\module-tax\Controller\Adminhtml\Tax\IgnoreTaxNotification.php
swatch_gallery_upload_image_aftervendor\magento\module-swatches\Controller\Adminhtml\Iframe\Show.php
store_address_formatvendor\magento\module-store\Model\Address\Renderer.php
sendfriend_productvendor\magento\module-send-friend\Controller\Product\Send.php
on_view_reportvendor\magento\module-search\Controller\Adminhtml\Term\Report.php
sales_order_state_change_beforevendor\magento\module-sales\Model\Service\OrderService.php
sales_order_creditmemo_cancelvendor\magento\module-sales\Model\Service\CreditmemoService.php
rss_order_new_collection_selectvendor\magento\module-sales\Model\Rss\NewOrder.php
sales_sale_collection_query_beforevendor\magento\module-sales\Model\ResourceModel\Sale\Collection.php
$this->_eventPrefix . ‘_set_sales_order’vendor\magento\module-sales\Model\ResourceModel\Order\Collection\AbstractCollection.php
$this->_eventPrefix . ‘_load_after’vendor\magento\module-sales\Model\ResourceModel\Order\Address\Collection.php
$object->getEventPrefix() . ‘_save_attribute_after’vendor\magento\module-sales\Model\ResourceModel\Attribute.php
$object->getEventPrefix() . ‘_save_attribute_before’vendor\magento\module-sales\Model\ResourceModel\Attribute.php
sales_order_status_unassignvendor\magento\module-sales\Model\Order\Status.php
email_shipment_set_template_vars_beforevendor\magento\module-sales\Model\Order\Shipment\Sender\EmailSender.php
$this->_eventPrefix . ‘_html_txn_id’vendor\magento\module-sales\Model\Order\Payment\Transaction.php
sales_order_payment_capturevendor\magento\module-sales\Model\Order\Payment\Operations\CaptureOperation.php
sales_order_payment_cancelvendor\magento\module-sales\Model\Order\Payment.php
sales_order_payment_cancel_creditmemovendor\magento\module-sales\Model\Order\Payment.php
sales_order_payment_refundvendor\magento\module-sales\Model\Order\Payment.php
sales_order_payment_voidvendor\magento\module-sales\Model\Order\Payment.php
sales_order_payment_cancel_invoicevendor\magento\module-sales\Model\Order\Payment.php
sales_order_payment_payvendor\magento\module-sales\Model\Order\Payment.php
sales_order_payment_place_endvendor\magento\module-sales\Model\Order\Payment.php
sales_order_payment_place_startvendor\magento\module-sales\Model\Order\Payment.php
sales_order_item_cancelvendor\magento\module-sales\Model\Order\Item.php
email_invoice_set_template_vars_beforevendor\magento\module-sales\Model\Order\Invoice\Sender\EmailSender.php
sales_order_invoice_registervendor\magento\module-sales\Model\Order\Invoice\PayOperation.php
sales_order_invoice_registervendor\magento\module-sales\Model\Order\Invoice.php
sales_order_invoice_cancelvendor\magento\module-sales\Model\Order\Invoice.php
sales_order_invoice_payvendor\magento\module-sales\Model\Order\Invoice.php
email_shipment_set_template_vars_beforevendor\magento\module-sales\Model\Order\Email\Sender\ShipmentSender.php
email_shipment_comment_set_template_vars_beforevendor\magento\module-sales\Model\Order\Email\Sender\ShipmentCommentSender.php
email_order_set_template_vars_beforevendor\magento\module-sales\Model\Order\Email\Sender\OrderSender.php
email_order_comment_set_template_vars_beforevendor\magento\module-sales\Model\Order\Email\Sender\OrderCommentSender.php
email_invoice_set_template_vars_beforevendor\magento\module-sales\Model\Order\Email\Sender\InvoiceSender.php
email_invoice_comment_set_template_vars_beforevendor\magento\module-sales\Model\Order\Email\Sender\InvoiceCommentSender.php
email_creditmemo_set_template_vars_beforevendor\magento\module-sales\Model\Order\Email\Sender\CreditmemoSender.php
email_creditmemo_set_template_vars_beforevendor\magento\module-sales\Model\Order\Creditmemo\Sender\EmailSender.php
sales_order_creditmemo_refundvendor\magento\module-sales\Model\Order\Creditmemo\RefundOperation.php
customer_address_formatvendor\magento\module-sales\Model\Order\Address\Renderer.php
order_cancel_aftervendor\magento\module-sales\Model\Order.php
sales_order_place_aftervendor\magento\module-sales\Model\Order.php
sales_order_place_beforevendor\magento\module-sales\Model\Order.php
EventPrefix_dev_grid_async_indexing_’ . $statevendor\magento\module-sales\Model\Config\Backend\Grid\AsyncIndexing.php
EventPrefix_sales_email_general_async_sending_’ . $statevendor\magento\module-sales\Model\Config\Backend\Email\AsyncSending.php
checkout_submit_all_aftervendor\magento\module-sales\Model\AdminOrder\Create.php
sales_convert_order_item_to_quote_itemvendor\magento\module-sales\Model\AdminOrder\Create.php
sales_convert_order_to_quotevendor\magento\module-sales\Model\AdminOrder\Create.php
adminhtml_sales_order_creditmemo_register_beforevendor\magento\module-sales\Controller\Adminhtml\Order\CreditmemoLoader.php
adminhtml_sales_order_create_process_datavendor\magento\module-sales\Controller\Adminhtml\Order\Create.php
adminhtml_sales_order_create_process_data_beforevendor\magento\module-sales\Controller\Adminhtml\Order\Create.php
admin_sales_order_address_updatevendor\magento\module-sales\Controller\Adminhtml\Order\AddressSave.php
adminhtml_customer_orders_add_action_renderervendor\magento\module-sales\Block\Adminhtml\Reorder\Renderer\Action.php
salesrule_validator_processvendor\magento\module-sales-rule\Model\RulesApplier.php
salesrule_rule_condition_combinevendor\magento\module-sales-rule\Model\Rule\Condition\Combine.php
salesrule_rule_get_coupon_typesvendor\magento\module-sales-rule\Model\Rule.php
sales_quote_address_discount_itemvendor\magento\module-sales-rule\Model\Quote\Discount.php
sales_quote_address_discount_itemvendor\magento\module-sales-rule\Model\Quote\Discount.php
adminhtml_controller_salesrule_prepare_savevendor\magento\module-sales-rule\Controller\Adminhtml\Promo\Quote\Save.php
adminhtml_block_promo_widget_chooser_prepare_collectionvendor\magento\module-sales-rule\Block\Adminhtml\Promo\Widget\Chooser.php
adminhtml_promo_quote_edit_tab_coupons_form_prepare_formvendor\magento\module-sales-rule\Block\Adminhtml\Promo\Quote\Edit\Tab\Coupons\Form.php
adminhtml_block_salesrule_actions_prepareformvendor\magento\module-sales-rule\Block\Adminhtml\Promo\Quote\Edit\Tab\Actions.php
rss_catalog_review_collection_selectvendor\magento\module-review\Model\Rss.php
review_review_collection_load_beforevendor\magento\module-review\Model\ResourceModel\Review\Collection.php
rating_rating_collection_load_beforevendor\magento\module-review\Model\ResourceModel\Rating\Collection.php
review_controller_product_init_beforevendor\magento\module-review\Controller\Product.php
review_controller_product_initvendor\magento\module-review\Controller\Product.php
review_controller_product_init_aftervendor\magento\module-review\Controller\Product.php
sales_prepare_amount_expressionvendor\magento\module-reports\Model\ResourceModel\Order\Collection.php
adminhtml_widget_grid_filter_collectionvendor\magento\module-reports\Block\Adminhtml\Grid.php
sales_quote_item_collection_products_after_loadvendor\magento\module-quote\Model\ResourceModel\Quote\Item\Collection.php
prepare_catalog_product_collection_pricesvendor\magento\module-quote\Model\ResourceModel\Quote\Item\Collection.php
EventPrefix_load_aftervendor\magento\module-quote\Model\ResourceModel\Quote\Address\Collection.php
sales_model_service_quote_submit_failurevendor\magento\module-quote\Model\QuoteManagement.php
sales_model_service_quote_submit_successvendor\magento\module-quote\Model\QuoteManagement.php
sales_model_service_quote_submit_beforevendor\magento\module-quote\Model\QuoteManagement.php
checkout_submit_all_aftervendor\magento\module-quote\Model\QuoteManagement.php
checkout_submit_beforevendor\magento\module-quote\Model\QuoteManagement.php
sales_quote_address_collect_totals_aftervendor\magento\module-quote\Model\Quote\TotalsCollector.php
sales_quote_address_collect_totals_beforevendor\magento\module-quote\Model\Quote\TotalsCollector.php
sales_quote_collect_totals_aftervendor\magento\module-quote\Model\Quote\TotalsCollector.php
sales_quote_collect_totals_beforevendor\magento\module-quote\Model\Quote\TotalsCollector.php
EventPrefix_import_data_beforevendor\magento\module-quote\Model\Quote\Payment.php
sales_quote_item_qty_set_aftervendor\magento\module-quote\Model\Quote\Item.php
sales_quote_item_set_productvendor\magento\module-quote\Model\Quote\Item.php
sales_convert_quote_to_ordervendor\magento\module-quote\Model\Quote\Address\ToOrder.php
EventPrefix _merge_aftervendor\magento\module-quote\Model\Quote.php
EventPrefix_merge_beforevendor\magento\module-quote\Model\Quote.php
sales_quote_product_add_aftervendor\magento\module-quote\Model\Quote.php
sales_quote_add_itemvendor\magento\module-quote\Model\Quote.php
sales_quote_remove_itemvendor\magento\module-quote\Model\Quote.php
items_additional_datavendor\magento\module-quote\Model\Cart\Totals\ItemConverter.php
persistent_session_expiredvendor\magento\module-persistent\Observer\CheckExpirePersistentQuoteObserver.php
persistent_session_expiredvendor\magento\module-persistent\Controller\Index\UnsetCookie.php
payment_method_assign_datavendor\magento\module-paypal\Model\Payflowpro.php
‘payment_method_assign_data_MethodCodevendor\magento\module-paypal\Model\Payflowpro.php
paypal_express_place_order_successvendor\magento\module-paypal\Controller\Express\AbstractExpress\PlaceOrder.php
payment_method_assign_datavendor\magento\module-payment\Model\Method\Adapter.php
payment_method_assign_data_MethodCodevendor\magento\module-payment\Model\Method\Adapter.php
payment_method_is_activevendor\magento\module-payment\Model\Method\Adapter.php
payment_method_is_activevendor\magento\module-payment\Model\Method\AbstractMethod.php
payment_method_assign_datavendor\magento\module-payment\Model\Method\AbstractMethod.php
payment_method_assign_data_MethodCodevendor\magento\module-payment\Model\Method\AbstractMethod.php
payment_cart_collect_items_and_amountsvendor\magento\module-payment\Model\Cart.php
payment_form_block_to_html_beforevendor\magento\module-payment\Block\Form\Cc.php
depersonalize_clear_sessionvendor\magento\module-page-cache\Model\Layout\DepersonalizePlugin.php
adminhtml_cache_refresh_typevendor\magento\module-page-cache\Model\Cache\Type.php
checkout_multishipping_refund_allvendor\magento\module-multishipping\Model\Checkout\Type\Multishipping.php
checkout_submit_all_aftervendor\magento\module-multishipping\Model\Checkout\Type\Multishipping.php
checkout_type_multishipping_create_orders_singlevendor\magento\module-multishipping\Model\Checkout\Type\Multishipping.php
checkout_type_multishipping_set_shipping_itemsvendor\magento\module-multishipping\Model\Checkout\Type\Multishipping.php
multishipping_checkout_controller_success_actionvendor\magento\module-multishipping\Controller\Checkout\ShippingPost.php
checkout_controller_multishipping_shipping_postvendor\magento\module-multishipping\Controller\Checkout\ShippingPost.php
clean_cache_after_reindexvendor\magento\module-indexer\Model\Processor\CleanCache.php
clean_cache_by_tagsvendor\magento\module-indexer\Model\Processor\CleanCache.php
catalog_product_prepare_index_selectvendor\magento\module-grouped-product\Model\ResourceModel\Product\Indexer\Price\Grouped.php
gift_options_prepare_itemsvendor\magento\module-gift-message\Block\Message\Inline.php
eav_collection_abstract_load_beforevendor\magento\module-eav\Model\Entity\Collection\AbstractCollection.php
adminhtml_block_eav_attribute_edit_form_initvendor\magento\module-eav\Block\Adminhtml\Attribute\Edit\Main\AbstractMain.php
visitor_activity_savevendor\magento\module-customer\Model\Visitor.php
visitor_initvendor\magento\module-customer\Model\Visitor.php
customer_logoutvendor\magento\module-customer\Model\Session.php
customer_data_object_loginvendor\magento\module-customer\Model\Session.php
customer_loginvendor\magento\module-customer\Model\Session.php
customer_data_object_loginvendor\magento\module-customer\Model\Session.php
customer_loginvendor\magento\module-customer\Model\Session.php
customer_session_initvendor\magento\module-customer\Model\Session.php
customer_save_after_data_objectvendor\magento\module-customer\Model\ResourceModel\CustomerRepository.php
customer_customer_authenticatedvendor\magento\module-customer\Model\Customer.php
customer_address_formatvendor\magento\module-customer\Model\Address\AbstractAddress.php
customer_data_object_loginvendor\magento\module-customer\Model\AccountManagement.php:
customer_customer_authenticatedvendor\magento\module-customer\Model\AccountManagement.php:
adminhtml_customer_save_aftervendor\magento\module-customer\Controller\Adminhtml\Index\Save.php
adminhtml_customer_prepare_savevendor\magento\module-customer\Controller\Adminhtml\Index\Save.php
customer_account_editedvendor\magento\module-customer\Controller\Account\EditPost.php
customer_register_successvendor\magento\module-customer\Controller\Account\CreatePost.php
adminhtml_block_html_beforevendor\magento\module-customer\Block\Adminhtml\Edit\Tab\Carts.php
admin_system_config_changed_section_currencyvendor\magento\module-currency-symbol\Model\System\Currencysymbol.php
admin_system_config_changed_section_currency_before_reinitvendor\magento\module-currency-symbol\Model\System\Currencysymbol.php
controller_action_nocookiesvendor\magento\module-cookie\Controller\Index\NoCookies.php
catalog_product_validate_variations_beforevendor\magento\module-configurable-product\Model\Product\Validator\Plugin.php
admin_system_config_changed_section_{$this->getSection()}vendor\magento\module-config\Model\Config.php
adminhtml_system_config_advanced_disableoutput_render_beforevendor\magento\module-config\Block\System\Config\Form\Fieldset\Modules\DisableOutput.php
cms_wysiwyg_images_static_urls_allowedvendor\magento\module-cms\Helper\Wysiwyg\Images.php
cms_page_rendervendor\magento\module-cms\Helper\Page.php
cms_controller_router_match_beforevendor\magento\module-cms\Controller\Router.php
cms_page_prepare_savevendor\magento\module-cms\Controller\Adminhtml\Page\Save.php
adminhtml_cmspage_on_deletevendor\magento\module-cms\Controller\Adminhtml\Page\Delete.php
checkout_type_onepage_save_order_aftervendor\magento\module-checkout\Model\Type\Onepage.php
checkout_submit_all_aftervendor\magento\module-checkout\Model\Type\Onepage.php
restore_quotevendor\magento\module-checkout\Model\Session.php
checkout_quote_destroyvendor\magento\module-checkout\Model\Session.php
load_customer_quote_beforevendor\magento\module-checkout\Model\Session.php
checkout_quote_initvendor\magento\module-checkout\Model\Session.php
custom_quote_processvendor\magento\module-checkout\Model\Session.php
checkout_cart_product_update_aftervendor\magento\module-checkout\Model\Cart.php
checkout_cart_save_aftervendor\magento\module-checkout\Model\Cart.php
checkout_cart_save_beforevendor\magento\module-checkout\Model\Cart.php
checkout_cart_update_items_aftervendor\magento\module-checkout\Model\Cart.php
checkout_cart_update_items_beforevendor\magento\module-checkout\Model\Cart.php
checkout_cart_product_add_aftervendor\magento\module-checkout\Model\Cart.php
checkout_allow_guestvendor\magento\module-checkout\Helper\Data.php
checkout_onepage_controller_success_actionvendor\magento\module-checkout\Controller\Onepage\Success.php
checkout_controller_onepage_saveOrdervendor\magento\module-checkout\Controller\Onepage\SaveOrder.php
checkout_cart_update_item_completevendor\magento\module-checkout\Controller\Cart\UpdateItemOptions.php
checkout_cart_add_product_completevendor\magento\module-checkout\Controller\Cart\Add.php
shortcut_buttons_containervendor\magento\module-checkout\Block\QuoteShortcutButtons.php
clean_cache_by_tagsvendor\magento\module-catalog\Plugin\Model\Product\Action\UpdateAttributesFlushCache.php
clean_cache_by_tagsvendor\magento\module-catalog\Plugin\Model\Product\Action\UpdateAttributesFlushCache.php
rss_catalog_notify_stock_collection_selectvendor\magento\module-catalog\Model\Rss\Product\NotifyStock.php
prepare_catalog_product_index_selectvendor\magento\module-catalog\Model\ResourceModel\Product\Indexer\Price\DefaultPrice.php
prepare_catalog_product_index_selectvendor\magento\module-catalog\Model\ResourceModel\Product\Indexer\Eav\Source.php
prepare_catalog_product_index_selectvendor\magento\module-catalog\Model\ResourceModel\Product\Indexer\Eav\Source.php
prepare_catalog_product_index_selectvendor\magento\module-catalog\Model\ResourceModel\Product\Indexer\Eav\Decimal.php
prepare_catalog_product_index_selectvendor\magento\module-catalog\Model\ResourceModel\Product\Indexer\Eav\AbstractEav.php
catalog_product_compare_item_collection_clearvendor\magento\module-catalog\Model\ResourceModel\Product\Compare\Item\Collection.php
catalog_product_collection_apply_limitations_aftervendor\magento\module-catalog\Model\ResourceModel\Product\Collection.php
catalog_product_collection_before_add_count_to_categoriesvendor\magento\module-catalog\Model\ResourceModel\Product\Collection.php
catalog_product_collection_load_aftervendor\magento\module-catalog\Model\ResourceModel\Product\Collection.php
catalog_prepare_price_selectvendor\magento\module-catalog\Model\ResourceModel\Product\Collection.php
catalog_product_delete_after_donevendor\magento\module-catalog\Model\ResourceModel\Product.php
catalog_category_tree_init_inactive_category_idsvendor\magento\module-catalog\Model\ResourceModel\Category\Tree.php
EventPrefix_add_is_active_filtervendor\magento\module-catalog\Model\ResourceModel\Category\Flat\Collection.php
EventPrefix_load_aftervendor\magento\module-catalog\Model\ResourceModel\Category\Flat\Collection.php
EventPrefix_load_beforevendor\magento\module-catalog\Model\ResourceModel\Category\Flat\Collection.php
catalog_category_flat_loadnodes_beforevendor\magento\module-catalog\Model\ResourceModel\Category\Flat.php
catalog_category_tree_init_inactive_category_idsvendor\magento\module-catalog\Model\ResourceModel\Category\Flat.php
EventPrefix_add_is_active_filtervendor\magento\module-catalog\Model\ResourceModel\Category\Collection.php
EventPrefix_load_aftervendor\magento\module-catalog\Model\ResourceModel\Category\Collection.php
EventPrefix_load_beforevendor\magento\module-catalog\Model\ResourceModel\Category\Collection.php
catalog_category_delete_after_donevendor\magento\module-catalog\Model\ResourceModel\Category.php
catalog_category_change_productsvendor\magento\module-catalog\Model\ResourceModel\Category.php
catalog_product_get_final_pricevendor\magento\module-catalog\Model\Product\Type\Price.php
$eventNamevendor\magento\module-catalog\Model\Product\Type\AbstractType.php
adminhtml_product_attribute_typesvendor\magento\module-catalog\Model\Product\Attribute\Source\Inputtype.php
catalog_product_attribute_update_beforevendor\magento\module-catalog\Model\Product\Action.php
catalog_product_is_salable_aftervendor\magento\module-catalog\Model\Product.php
catalog_product_is_salable_beforevendor\magento\module-catalog\Model\Product.php
EventPrefix_validate_aftervendor\magento\module-catalog\Model\Product.php
EventPrefix_validate_beforevendor\magento\module-catalog\Model\Product.php
clean_cache_by_tagsvendor\magento\module-catalog\Model\Category.php
category_movevendor\magento\module-catalog\Model\Category.php
EventPrefix_move_aftervendor\magento\module-catalog\Model\Category.php
EventPrefix_move_beforevendor\magento\module-catalog\Model\Category.php
catalog_controller_product_viewvendor\magento\module-catalog\Helper\Product\View.php
catalog_controller_product_init_beforevendor\magento\module-catalog\Helper\Product.php
catalog_product_compare_remove_productvendor\magento\module-catalog\Controller\Product\Compare\Remove.php
catalog_product_compare_add_productvendor\magento\module-catalog\Controller\Category\View.php
catalog_controller_category_init_aftervendor\magento\module-catalog\Controller\Category\View.php
controller_action_catalog_product_save_entity_aftervendor\magento\module-catalog\Controller\Adminhtml\Product\Save.php
catalog_product_new_actionvendor\magento\module-catalog\Controller\Adminhtml\Product\NewAction.php
catalog_product_gallery_upload_image_aftervendor\magento\module-catalog\Controller\Adminhtml\Product\Gallery\Upload.php
catalog_product_edit_actionvendor\magento\module-catalog\Controller\Adminhtml\Product\Edit.php
catalog_product_to_website_changevendor\magento\module-catalog\Controller\Adminhtml\Product\Action\Attribute\Save.php
catalog_category_prepare_savevendor\magento\module-catalog\Controller\Adminhtml\Category\Save.php
catalog_controller_category_deletevendor\magento\module-catalog\Controller\Adminhtml\Category\Delete.php
category_prepare_ajax_responsevendor\magento\module-catalog\Controller\Adminhtml\Category.php
shortcut_buttons_containervendor\magento\module-catalog\Block\ShortcutButtons.php
rss_catalog_special_xml_callbackvendor\magento\module-catalog\Block\Rss\Product\Special.php
rss_catalog_new_xml_callbackvendor\magento\module-catalog\Block\Rss\Product\NewProducts.php
rss_catalog_category_xml_callbackvendor\magento\module-catalog\Block\Rss\Category.php
catalog_product_option_price_configuration_aftervendor\magento\module-catalog\Block\Product\View\Options.php
catalog_product_view_configvendor\magento\module-catalog\Block\Product\View.php
catalog_product_upsellvendor\magento\module-catalog\Block\Product\ProductList\Upsell.php
catalog_block_product_list_collectionvendor\magento\module-catalog\Block\Product\ListProduct.php
catalog_block_product_status_displayvendor\magento\module-catalog\Block\Product\AbstractProduct.php
catalog_product_gallery_prepare_layoutvendor\magento\module-catalog\Block\Adminhtml\Product\Helper\Form\Gallery\Content.php
adminhtml_catalog_product_grid_prepare_massactionvendor\magento\module-catalog\Block\Adminhtml\Product\Grid.php
adminhtml_catalog_product_edit_tab_attributes_create_html_beforevendor\magento\module-catalog\Block\Adminhtml\Product\Edit\Tab\Attributes\Create.php
adminhtml_catalog_product_edit_element_typesvendor\magento\module-catalog\Block\Adminhtml\Product\Edit\Tab\Attributes.php
adminhtml_catalog_product_edit_prepare_formvendor\magento\module-catalog\Block\Adminhtml\Product\Edit\Tab\Attributes.php
adminhtml_catalog_product_form_prepare_excluded_field_listvendor\magento\module-catalog\Block\Adminhtml\Product\Edit\Action\Attribute\Tab\Attributes.php
adminhtml_catalog_product_attribute_set_toolbar_main_html_beforevendor\magento\module-catalog\Block\Adminhtml\Product\Attribute\Set\Toolbar\Main.php
adminhtml_catalog_product_attribute_set_main_html_beforevendor\magento\module-catalog\Block\Adminhtml\Product\Attribute\Set\Main.php
adminhtml_catalog_product_edit_element_typesvendor\magento\module-catalog\Block\Adminhtml\Product\Attribute\NewAttribute\Product\Attributes.php
adminhtml_catalog_product_edit_prepare_formvendor\magento\module-catalog\Block\Adminhtml\Product\Attribute\NewAttribute\Product\Attributes.php
product_attribute_grid_buildvendor\magento\module-catalog\Block\Adminhtml\Product\Attribute\Grid.php
product_attribute_form_build_main_tabvendor\magento\module-catalog\Block\Adminhtml\Product\Attribute\Edit\Tab\Main.php
adminhtml_product_attribute_typesvendor\magento\module-catalog\Block\Adminhtml\Product\Attribute\Edit\Tab\Main.php
adminhtml_catalog_product_attribute_edit_frontend_prepare_formvendor\magento\module-catalog\Block\Adminhtml\Product\Attribute\Edit\Tab\Front.php
product_attribute_form_build_front_tabvendor\magento\module-catalog\Block\Adminhtml\Product\Attribute\Edit\Tab\Front.php
product_attribute_form_buildvendor\magento\module-catalog\Block\Adminhtml\Product\Attribute\Edit\Tab\Advanced.php
adminhtml_catalog_category_tree_can_add_sub_categoryvendor\magento\module-catalog\Block\Adminhtml\Category\Tree.php
adminhtml_catalog_category_tree_can_add_root_categoryvendor\magento\module-catalog\Block\Adminhtml\Category\Tree.php
adminhtml_catalog_category_tree_is_moveablevendor\magento\module-catalog\Block\Adminhtml\Category\Tree.php
catalogsearch_reset_search_resultvendor\magento\module-catalog-search\Model\ResourceModel\Fulltext.php
catelogsearch_searchable_attributes_load_aftervendor\magento\module-catalog-search\Model\Indexer\Fulltext\Action\Full.php
catelogsearch_searchable_attributes_load_aftervendor\magento\module-catalog-search\Model\Indexer\Fulltext\Action\DataProvider.php
clean_cache_by_tagsvendor\magento\module-catalog-rule\Model\Indexer\AbstractIndexer.php
adminhtml_controller_catalogrule_prepare_savevendor\magento\module-catalog-rule\Controller\Adminhtml\Promo\Catalog\Save.php
catalogrule_dirty_noticevendor\magento\module-catalog-rule\Controller\Adminhtml\Promo\Catalog\Index.php
clean_cache_by_tagsvendor\magento\module-catalog-inventory\Model\Indexer\Stock\AbstractAction.php
catalog_product_import_bunch_save_aftervendor\magento\module-catalog-import-export\Model\Import\Product.php
catalog_product_import_finish_beforevendor\magento\module-catalog-import-export\Model\Import\Product.php
catalog_product_import_bunch_delete_aftervendor\magento\module-catalog-import-export\Model\Import\Product.php
catalog_product_import_bunch_delete_commit_beforevendor\magento\module-catalog-import-export\Model\Import\Product.php
catalog_product_get_final_pricevendor\magento\module-bundle\Pricing\Price\BundleSelectionPrice.php
catalog_product_prepare_index_selectvendor\magento\module-bundle\Model\ResourceModel\Indexer\Price.php
catalog_product_get_final_pricevendor\magento\module-bundle\Model\Product\Price.php
catalog_product_get_final_pricevendor\magento\module-bundle\Model\Product\Price.php
prepare_catalog_product_collection_pricesvendor\magento\module-bundle\Model\Product\Price.php
catalog_product_option_price_configuration_aftervendor\magento\module-bundle\Block\Catalog\Product\View\Type\Bundle.php
backend_auth_user_login_failedvendor\magento\module-backend\Model\Auth.php
backend_auth_user_login_failedvendor\magento\module-backend\Model\Auth.php
backend_auth_user_login_successvendor\magento\module-backend\Model\Auth.php
$eventNamevendor\magento\module-backend\Controller\Adminhtml\System\Store\Save.php
store_group_savevendor\magento\module-backend\Controller\Adminhtml\System\Store\Save.php
store_deletevendor\magento\module-backend\Controller\Adminhtml\System\Store\DeleteStorePost.php
theme_save_aftervendor\magento\module-backend\Controller\Adminhtml\System\Design\Save.php
adminhtml_cache_flush_systemvendor\magento\module-backend\Controller\Adminhtml\Cache\FlushSystem.php
adminhtml_cache_flush_allvendor\magento\module-backend\Controller\Adminhtml\Cache\FlushAll.php
clean_static_files_cache_aftervendor\magento\module-backend\Controller\Adminhtml\Cache\CleanStaticFiles.php
clean_media_cache_aftervendor\magento\module-backend\Controller\Adminhtml\Cache\CleanMedia.php
clean_catalog_images_cache_aftervendor\magento\module-backend\Controller\Adminhtml\Cache\CleanImages.php
adminhtml_cache_flush_allvendor\magento\module-backend\Console\Command\CacheFlushCommand.php
adminhtml_cache_flush_systemvendor\magento\module-backend\Console\Command\CacheCleanCommand.php
backend_block_widget_grid_prepare_grid_beforevendor\magento\module-backend\Block\Widget\Grid.php
adminhtml_block_html_beforevendor\magento\module-backend\Block\Template.php
adminhtml_store_edit_form_prepare_formvendor\magento\module-backend\Block\System\Store\Edit\AbstractForm.php
checkout_directpost_placeOrdervendor\magento\module-authorizenet\Controller\Directpost\Payment\Place.php
layout_render_beforevendor\magento\framework\View\Result\Layout.php
layout_render_before_FullActionNamevendor\magento\framework\View\Result\Layout.php
core_layout_block_create_aftervendor\magento\framework\View\Layout\Generator\Block.php
layout_generate_blocks_aftervendor\magento\framework\View\Layout\Builder.php
layout_generate_blocks_beforevendor\magento\framework\View\Layout\Builder.php
layout_load_beforevendor\magento\framework\View\Layout\Builder.php
core_layout_render_elementvendor\magento\framework\View\Layout.php
view_message_block_render_grouped_html_aftervendor\magento\framework\View\Element\AbstractBlock.php
EventPrefix_process_relationvendor\magento\framework\Model\ResourceModel\Db\VersionControl\RelationComposite.php
EventPrefix_load_aftervendor\magento\framework\Model\ResourceModel\Db\Collection\AbstractCollection.php
core_collection_abstract_load_aftervendor\magento\framework\Model\ResourceModel\Db\Collection\AbstractCollection.php
$this->_eventPrefix . ‘_load_before’vendor\magento\framework\Model\ResourceModel\Db\Collection\AbstractCollection.php
‘core_collection_abstract_load_before’vendor\magento\framework\Model\ResourceModel\Db\Collection\AbstractCollection.php
EventPrefix_clearvendor\magento\framework\Model\AbstractModel.php
model_delete_commit_aftervendor\magento\framework\Model\AbstractModel.php
EventPrefix_delete_commit_aftervendor\magento\framework\Model\AbstractModel.php
model_delete_aftervendor\magento\framework\Model\AbstractModel.php
clean_cache_by_tagsvendor\magento\framework\Model\AbstractModel.php
EventPrefix_delete_aftervendor\magento\framework\Model\AbstractModel.php
EventPrefix_delete_beforevendor\magento\framework\Model\AbstractModel.php
model_delete_beforevendor\magento\framework\Model\AbstractModel.php
EventPrefix_save_aftervendor\magento\framework\Model\AbstractModel.php
clean_cache_by_tagsvendor\magento\framework\Model\AbstractModel.php
model_save_aftervendor\magento\framework\Model\AbstractModel.php
EventPrefix_save_beforevendor\magento\framework\Model\AbstractModel.php
model_save_beforevendor\magento\framework\Model\AbstractModel.php
$this->_eventPrefix . ‘_load_after’vendor\magento\framework\Model\AbstractModel.php
model_load_aftervendor\magento\framework\Model\AbstractModel.php
$this->_eventPrefix . ‘_load_before’vendor\magento\framework\Model\AbstractModel.php
model_load_beforevendor\magento\framework\Model\AbstractModel.php
session_abstract_add_messagevendor\magento\framework\Message\Manager.php
session_abstract_clear_messagesvendor\magento\framework\Message\Manager.php
currency_display_options_formingvendor\magento\framework\Locale\Currency.php
entity_manager_save_beforevendor\magento\framework\EntityManager\Operation\Update.php
entity_manager_save_aftervendor\magento\framework\EntityManager\Operation\Update.php
entity_manager_load_beforevendor\magento\framework\EntityManager\Operation\Read.php
entity_manager_delete_beforevendor\magento\framework\EntityManager\Operation\Delete.php
entity_manager_delete_beforevendor\magento\framework\EntityManager\Operation\Delete.php
entity_manager_save_beforevendor\magento\framework\EntityManager\Operation\Create.php
entity_manager_save_aftervendor\magento\framework\EntityManager\Operation\Create.php
$this->resolveEntityPrefix($entityType) . ‘_’ . $eventSuffixvendor\magento\framework\EntityManager\EventManager.php
$eventNamevendor\magento\framework\EntityManager\EventManager.php
abstract_search_result_load_aftervendor\magento\framework\Data\AbstractSearchResult.php
Eventprefix_load_after’vendor\magento\framework\Data\AbstractSearchResult.php
Eventprefix_load_before’vendor\magento\framework\Data\AbstractSearchResult.php
abstract_search_result_load_beforevendor\magento\framework\Data\AbstractSearchResult.php
controller_action_noroutevendor\magento\framework\Controller\Noroute\Index.php
controller_action_layout_render_beforevendor\magento\framework\App\View.php
controller_action_layout_render_before_FullActionNamevendor\magento\framework\App\View.php
controller_front_send_response_beforevendor\magento\framework\App\Http.php
controller_action_postdispatchvendor\magento\framework\App\Action\Action.php
controller_action_postdispatch_RouteNamevendor\magento\framework\App\Action\Action.php
controller_action_postdispatch_ FullActionNamevendor\magento\framework\App\Action\Action.php
controller_action_predispatch_FullActionNamevendor\magento\framework\App\Action\Action.php
controller_action_predispatch_RouteNamevendor\magento\framework\App\Action\Action.php
controller_action_predispatchvendor\magento\framework\App\Action\Action.php

Magento 2 extension to hide price or add to cart button

This blogpost provides a free magento 2 extension to hide price and addtocart button on category page, product page, wish list page and compare page. We have a different features in this extension:-

  • Hide price
  • Hide add to cart button
  • Show price for certain customer Id
  • Show price for certain product Id
  • Enable hide price for selected customer group
  • Allow you to add custom Html from backend to replace add to cart button
  • Allow you to add custom css for replaced add to cart

Extension Configuration page Admin Screen

Hide Price on Compare Page

Hide Price on Category page

Hide Price on Product Page

Hide Price on Wishlist Page

Versions: I’ve tested the module with the version 2.1.6

Click here to download the module

Let me know if you found any issue or have any query.

Magento 2 all about error reports

In this blogpost we will learn how to see error logs of Magento directly on frontend rather then going to reports folder. As we know that Magento does not display error data directly on UI, it rather provide a file name which is found in var/report folder in Magento. This is a good thing and done for security reason, since we don’t want others to know about our file name and paths, which usually shows up in error track. The error reports are generated in text file which have their names in randomly generated number such as 657030389. You can open these files in any text editor to view the error message.

But, during your development phase sometime we want to get this message directly on frontend rather than reading files again and again as this saves our time also, for this we need to make several changes.
Go to pub/errors/local.sample.xml and rename this file to /errors/local.xml Now you would be able to view the error message in your web browser itself.

Above was all about the developer, now what if any such issue appears in front of your customer, then it will not look good? You should display a good looking UI and message to end user. For that we can open the pub/errors/local.xml file and change the

	<action>print</action>
        to 
	<action>email</action>

This will show a nice form on front end, where user can email you back when they view the error message. You can also change style of this page then you can modify it in pub/errors/default/report.html

Magento 2 different ways to reset admin user password

In this post, we will learn how to change the magento admin user password from database or FTP or cmd. This will help you in case you are not able to recover it using Forgot Password option. (Mostly happen when working locally). Consider that you have server access to magento i.e database or ftp access.

Reset magento 2 admin password With Database

The easiest way to change magento admin password is using database. Open your database in phpmyadmin, and execute the below query:-

UPDATE admin_user SET password = CONCAT(SHA2('xxxxxxxxpassword', 256), ':xxxxxxxx:1') WHERE username = 'arushi' 

Replace password with your password. Each xxxxxxxx sequence should be replaced with any random characters.

Reset magento 2 admin password using Command line

php bin/magento admin:user:create --admin-user mys_username --admin-password p@123 --admin-email my@email.com --admin-firstname john --admin-lastname Hu

Username and email should match with database to update all details. Replace p@123 with your password.

Reset magento 2 admin password using FTP

Through FTP open the class Magento\User\Model\User located at vendor\magento\module-user\Model\User.php
Next find the verifyIdentity() function around line no: 561. Inside the verifyIdentity function, this code is written

return $result;

You need to replace the line with

return true; 

Thus we are login without using any password and now you can change the password from admin panel.

Magento 2 update Mime type or image data for customer or product using REST API

In our previous blog post we looked how to add an image custom attribute to customer, In this blogpost I will be sharing how to set the value of the image type attribute in JSON while saving product or customer using REST API.
So let’s look at the REST Url for customer creation:-

http://domainname//index.php/rest/V1/customers

To save image we have to convert it into base64 format and then add to json in “base64EncodedData” key, you can look in below JSON format and use it to create customer:-

{
     "customer": {
         "email": "abc1@gmail.com",
         "firstname": "Abc",
         "lastname": "Xyz" ,
         "custom_attributes": [
          {
            "attribute_code": "twilio_image",
            "value": {
                "base64EncodedData": "iVBORw0KGgoAAAANSUhEUgAAACgAAAAoCAYAAACM/rhtAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAWtJREFUeNpi/P//P8NgBkwMgxyMOnDUgTDAyMhIDNYF4vNA/B+IDwCxHLoakgEoFxODiQRXQUYi4e3k2gfDjMRajsP3zED8F8pmA+JvUDEYeArEMugOpFcanA/Ef6A0CPwC4uNoag5SnAjJjGI2tKhkg4rLAfFGIH4IxEuBWIjSKKYkDfZCHddLiwChVhokK8YGohwEZYy3aBmEKmDEhOCgreomo+VmZHxsMEQxIc2MAx3FO/DI3RxMmQTZkI9ALDCaSUYdOOrAIeRAPzQ+PxCHUM2FFDb5paGNBPRa5C20bUhxc4sSB4JaLnvxVHWHsbVu6OnACjyOg+HqgXKgGRD/JMKBoD6LDb0dyAPE94hwHAw/hGYcujlwEQmOg+EV9HJgLBmOg+FMWjsQVKR8psCBoDSrQqoDSSmoG6Hpj1wA6ju30LI9+BBX4UsC+Ai0T4BWVd1EIL5PgeO+APECmoXgaGtm1IE0AgABBgAJAICuV8dAUAAAAABJRU5ErkJggg==",
                "type": "image/png",
                "name": "new_image.png"
            }
          }
        ]

     },

     "password": "Abc@123456"
  }

Product

Below is the JSON format that we can use for uploading product images

{
        "entry": {
            "media_type": "image",
            "label": "Image",
            "position": 1,
            "disabled": false,
            "types": [
                "image",
                "small_image",
                "thumbnail"
            ],
            "file": "/m/b/mb01-blue-0.png",
            "content": {
                "base64EncodedData": "iVBORw0KGgoAAAANSUhEUgAAACgAAAAoCAYAAACM/rhtAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAWtJREFUeNpi/P//P8NgBkwMgxyMOnDUgTDAyMhIDNYF4vNA/B+IDwCxHLoakgEoFxODiQRXQUYi4e3k2gfDjMRajsP3zED8F8pmA+JvUDEYeArEMugOpFcanA/Ef6A0CPwC4uNoag5SnAjJjGI2tKhkg4rLAfFGIH4IxEuBWIjSKKYkDfZCHddLiwChVhokK8YGohwEZYy3aBmEKmDEhOCgreomo+VmZHxsMEQxIc2MAx3FO/DI3RxMmQTZkI9ALDCaSUYdOOrAIeRAPzQ+PxCHUM2FFDb5paGNBPRa5C20bUhxc4sSB4JaLnvxVHWHsbVu6OnACjyOg+HqgXKgGRD/JMKBoD6LDb0dyAPE94hwHAw/hGYcujlwEQmOg+EV9HJgLBmOg+FMWjsQVKR8psCBoDSrQqoDSSmoG6Hpj1wA6ju30LI9+BBX4UsC+Ai0T4BWVd1EIL5PgeO+APECmoXgaGtm1IE0AgABBgAJAICuV8dAUAAAAABJRU5ErkJggg==",
                "type": "image/png",
                "name": "new_image.png"
            }
        }
    }

To encode an image use the below code:-

@base64_encode(file_get_contents(image_filepath))

Magento 2 upload custom image attribute for customer registration page

In our earlier blogpost we have learned to create the custom customer attribute of select type, now here we will see how to add an image attribute to customers and will show it on the customer registration page on frontend and customer edit page in admin panel. Earlier we used installData and now we are doing it with upgradeData.php file, process is totally same. The only difference among these file is that installData.php is executed with module installation and upgradeData.php is version based and is executed after installation whenever we change version in module.xml. So update the setup_version in module.xml if using upgardeData.php

Here is the code to add a custom attribute of image type for customer. Create the file in Namespace\Modulename\Setup\ folder:-

<?php
namespace W3solver\Callforprice\Setup;

use Magento\Framework\Setup\UpgradeDataInterface;
use Magento\Framework\Setup\ModuleDataSetupInterface;
use Magento\Framework\Setup\ModuleContextInterface;
use Magento\Customer\Setup\CustomerSetupFactory;
use Magento\Customer\Model\Customer;
use Magento\Eav\Model\Entity\Attribute\Set as AttributeSet;
use Magento\Eav\Model\Entity\Attribute\SetFactory as AttributeSetFactory;


class UpgradeData implements UpgradeDataInterface {

    protected $customerSetupFactory;
    private $attributeSetFactory;

    public function __construct(
    CustomerSetupFactory $customerSetupFactory, AttributeSetFactory $attributeSetFactory
    ) {
        $this->customerSetupFactory = $customerSetupFactory;
        $this->attributeSetFactory = $attributeSetFactory;
    }


    public function upgrade( ModuleDataSetupInterface $setup, ModuleContextInterface $context ) {
        
        if (version_compare($context->getVersion(), '1.0.4') < 0) {
        
            $setup->startSetup();
            $customerSetup = $this->customerSetupFactory->create(['setup' => $setup]);
     
            $customerEntity = $customerSetup->getEavConfig()->getEntityType('customer');
            $attributeSetId = $customerEntity->getDefaultAttributeSetId();
     
            $attributeSet = $this->attributeSetFactory->create();
            $attributeGroupId = $attributeSet->getDefaultGroupId($attributeSetId);
     
            $customerSetup->addAttribute(\Magento\Customer\Model\Customer::ENTITY, 'twilio_image', [
                'type' => 'string',
                'label' => 'Twilio Image',
                'input' => 'file',
                "source" => '',
                'required' => false,
                'default' => '0',
                'visible' => true,
                'user_defined' => true,
                'sort_order' => 210,
                'position' => 210,
                'system' => false,
            ]);

            $image = $customerSetup->getEavConfig()->getAttribute(Customer::ENTITY, 'twilio_image')
                    ->addData([
                'attribute_set_id' => $attributeSetId,
                'attribute_group_id' => $attributeGroupId,
                'used_in_forms' => ['adminhtml_customer', 'customer_account_create', 'customer_account_edit'],
            ]);
     
            $image->save();
            $setup->endSetup();
        }  
    }
}

Run bin/magento setup:upgrade so that attribute will be added to database. You can now check in admin panel if attribute is coming:-

To show attribute on customer registration page on frontend you need to create a layout file and template for the same. Below is the code for the same.

Namespace/Modulename/view/frontend/layout/customer_account_create.xml
<?xml version="1.0"?>
<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" layout="1column" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
<body>
    <referenceContainer name="form.additional.info">
        <block class="Magento\Framework\View\Element\Template" name="additional_field_register" template="W3solver_Callforprice::additionalfieldregister.phtml"/>
    </referenceContainer>
</body>
</page>

Create template file now

Namespace/Modulename/view/frontend/templates/additionalfieldregister.phtml
<fieldset class="fieldset create account" data-hasrequired="<?php /* @escapeNotVerified */
echo __('* Required Fields') ?>">
    <legend class="legend"><span><?php /* @escapeNotVerified */
            echo __('Additional Information') ?></span></legend>

<p>
<div class="field twilio_image required">
    <label for="twilio_image" class="label"><span><?php /* @escapeNotVerified */
            echo __('Image') ?></span></label>
    <div class="control">
        <input type="file" name="twilio_image" id="twilio_image" title="<?php /* @escapeNotVerified */
        echo __('Image') ?>" class="input-text" data-validate="{required:true}">
    </div>
</div>
</p></fieldset>

Clear the cache once and you can see the attribute on customer registration page.

Feel free to add comment if you face any issue or for any suggestion.