PrestaShop 1.7 Module Hooks

In PrestaShop 1.7, modules can use hooks to execute code after various actions occur and add additional code to display in various places in the Front Office and Back Office. Hooks can be viewed on the Modules > Positions tab in the Back Office. The hooks are listed alphabetically by name in the Back Office and have a brief description.

Hooks starting with action are executed before or after an action has occurred. Hooks starting with display and used to add additional code to TPL files in the theme. By default, only the hooks with a Position of 1 are displayed on the Positions subtab of the Modules tab. To view all hooks, tick the Display non-positionable hooks checkbox.

To call a hook, use the code Hook::exec('name'), where name is from the Name column below. In PrestaShop, it is convention to put the code generated by the hook in a variable called HOOK_NAME. For example, the code to call all the modules in the Homepage content hook and then pass them into a TPL is $this->context->smarty->assign('HOOK_HOME' => Hook::exec('displayHome'));.

Here's a list of all the module hooks available in PrestaShop v1.6 along with descriptions of what they can be used for and the parameters available to them. Parameters can be accessed like this: function hookDisplayFooterProduct($params) { $product = $params['product']; }

NameDescriptionParameters
actionAdmin<Action>BeforeCalled before the specified action is performed by a Back Office controllercontroller
actionAdmin<Action>AfterCalled after the specified action is performed by a Back Office controllercontroller, return
actionAdmin<Class><Action>BeforeCalled before the specified action in the specified class is performed by a Back Office controllercontroller
actionAdmin<Class><Action>AfterCalled after the specified action in the specified class is performed by a Back Office controllercontroller, return
actionAdminControllerSetMediaCalled after adding media to the Back Office header 
actionAdminLoginControllerSetMediaCalled after adding media to the Back Office login page header 
actionAdminMetaSaveCalled after saving Preferences > SEO & URLs tab 
actionAdminMetaAfterWriteRobotsFileCalled after writing robots.txt, before closing the filerb_data, write_fd (modifiable)
actionAdminMetaBeforeWriteRobotsFileCalled before writing robots.txtrb_data (modifiable)
actionAdminOrdersTrackingNumberUpdateCalled after the tracking number update email is sentorder, customer, carrier
actionAdminThemesControllerUpdate_optionsAfterCalled after clicking the Save button on the Design > Theme & Logo tab 
actionAttributeDeleteCalled while deleting a product attributeid_attribute
actionAttributeCombinationDeleteCalled while deleting a product attribute combinationid_product_attribute
actionAttributeCombinationSaveCalled while saving a product attribute combinationid_product_attribute, id_attributes
actionAttributeGroupDeleteCalled while deleting a product attribute groupid_attribute_group
actionAttributeGroupSaveCalled while saving a product attribute groupid_attribute_group
actionAttributePostProcessCalled on post-process of product attributesid_attribute
actionAttributeSaveCalled while saving a product attributeid_attribute
actionAuthenticationCalled after a customer successfully signs incustomer
actionAuthenticationBeforeCalled before a customer is authenticated 
actionAjaxDieBeforeCalled before the results of an AJAX request are displayedcontroller, method, value
actionAjaxDie<Controller><Method>BeforeCalled before the results of an AJAX request for the specified controller and method are displayedcontroller, method, value
actionBeforeCartUpdateQtyCalled before the quantity of a cart product is updatedcart, product, id_product_attribute, id_customization, quantity, operator, id_address_delivery, shop, auto_add_cart_rule
actionCarrierProcessCalled when the carrier changes during checkoutcart
actionCarrierUpdateCalled when a carrier is updated in the Back Officeid_carrier (current), carrier (new)
actionCartSaveCalled when a product is added to the cart or the cart's contents are modified 
actionCartSummaryCalled to add variables to the cart summarydelivery, delivery_state, invoice, invoice_state, formattedAddresses, products, gift_products, discounts, is_virtual_cart, total_discounts, total_discounts_tax_exc, total_wrapping, total_wrapping_tax_exc, total_shipping, total_shipping_tax_exc, total_products_wt, total_products, total_price, total_tax, total_price_without_tax, is_multi_address_delivery, free_ship, carrier
actionCartUpdateQuantityBeforeCalled before the a product quantity is updated in the cartcart, product, id_product_attribute, id_customization, quantity, operator, id_address_delivery, shop, auto_add_cart_rule
actionCategoryAddCalled when a product category is createdcategory
actionCategoryDeleteCalled when a product category is deletedcategory, delete_children
actionCategoryUpdateCalled when a product category is modifiedcategory
action<Controller>ListingFieldsModifierCalled to modify the listing query and fields for the specified controllerselect (modifiable), join (modifiable), where (modifiable), group_by (modifiable), order_by (modifiable), order_way (modifiable), fields (modifiable)
action<Controller>ListingResultsModifierCalled to modify the listing results for the specified controllerlist (modifiable), list_total (modifiable)
action<Controller>FormModifierCalled to modify the form fields and values for the specified controllerfields (modifiable), fields_value (modifiable), form_vars (modifiable)
action<Controller>OptionsModifierCalled to modify the option fields and values for the specified controlleroptions (modifiable), option_vars (modifiable)
actionCustomerAccountAddCalled when a new customer successfully creates an account_POST, newCustomer
actionCustomerAddGroupsCalled before adding a customer to groupsid_customer, groups
actionCustomerBeforeUpdateGroupCalled before updating a customer's groupsid_customer, groups
actionCustomerLogoutBeforeCalled before a customer logs outcustomer
actionCustomerLogoutAfterCalled after a customer logs outcustomer
actionDeliveryPriceByPriceCalled to override the delivery price by priceid_carrier, order_total, id_zone
actionDeliveryPriceByWeightCalled to override the delivery price by weightid_carrier, total_weight, id_zone
actionDispatcherCalled before running a controllercontroller_type, controller_class, is_module
actionDeleteProductInCartAfterCalled after a product is deleted from the cartid_cart, id_product, id_product_attribute, customization_id, id_address_delivery
actionDownloadAttachmentCalled before downloading a product attachmentattachment
actionEmailAddAfterContentCalled just after fetching a mail template template, template_html (modifiable), template_txt (modifiable), id_lang
actionEmailAddBeforeContentCalled just before fetching a mail template template, template_html (modifiable), template_txt (modifiable), id_lang
actionFeatureDeleteCalled while deleting a product featureid_feature
actionFeatureSaveCalled while saving a product featureid_feature
actionFeatureValueDeleteCalled while deleting a product feature valueid_feature_value
actionFeatureValueSaveCalled while saving a product feature valueid_feature_value
actionFrontControllerSetMediaCalled after adding media to a Front Office controller 
actionGetExtraMailTemplateVarsCalled to add template variables to emailstemplate, template_vars, extra_template_vars (modifiable), id_lang
actionGetIDZoneByAddressIDUsed to override the zone for an addressid_address
actionGetProductPropertiesAfterCalled after getting the properties of a productid_lang, product, context
actionGetProductPropertiesBeforeCalled before getting the properties of a productid_lang, product, context
actionHtaccessCreateCalled after writing the .htaccess access 
actionInvoiceNumberFormattedCalled to override the formatted invoice numberid_lang, id_shop, number
actionModuleInstallAfterCalled after installing a moduleobject
actionModuleInstallBeforeCalled before installing a moduleobject
actionModuleRegisterAfterCalled after a module hook is registeredobject, hook_name
actionModuleRegisterBeforeCalled before a module hook is registeredobject, hook_name
actionModuleUnRegisterAfterCalled after a module hook is unregisteredobject, hook_name
actionModuleUnRegisterBeforeCalled before a module hook is unregisteredobject, hook_name
actionObjectAddBeforeCalled before any object is addedobject
actionObject<Class>AddBeforeCalled before any object of the specified class is addedobject
actionObjectAddAfterCalled after any object is addedobject
actionObject<Class>AddAfterCalled after any object of the specified class is addedobject
actionObjectDeleteBeforeCalled before any object is updatedobject
actionObject<Class>DeleteBeforeCalled before any object of the specified class is updatedobject
actionObjectDeleteAfterCalled after any object is updatedobject
actionObject<Class>DeleteAfterCalled after any object of the specified class is updatedobject
actionObjectUpdateBeforeCalled before any object is updatedobject
actionObject<Class>UpdateBeforeCalled before any object of the specified class is updatedobject
actionObjectUpdateAfterCalled after any object is updatedobject
actionObject<Class>UpdateAfterCalled after any object of the specified class is updatedobject
actionOnImageResizeAfterCalled after resizing an imagedst_file, file_type
actionOnImageCutAfterCalled after cropping an imagedst_file, file_type
actionOrderEditedCalled when an order is editedorder
actionOrderReturnCalled when a customer returns a productorderReturn
actionOrderSlipAddCalled when a credit slip is createdorder, productList, qtyList
actionOrderStatusPostUpdateCalled after the status of an order changesnewOrderStatus, id_order
actionOrderStatusUpdateCalled before the status of an order changesnewOrderStatus, id_order
actionPasswordRenewCalled after a customer updates their passwordcustomer, password
actionPaymentCCAddCalled after an order payment is addedpaymentCC
actionPaymentConfirmationCalled after the order payment is validatedid_order
actionPDFInvoiceRenderCalled before the PDF invoice is renderedorder_invoice_list
actionProductAddCalled after a product is createdid_product, product
actionProductAttributeDeleteCalled after a product combination is deletedid_product_attribute, deleteAllAttributes
actionProductAttributeUpdateCalled after a product combination is updatedid_product_attribute
actionProductCancelCalled after cancelling a product in an orderorder, id_order_detail
actionProductCoverageCalled when the quantity of a product is reduced from a warehouseid_product, id_product_attribute, warehouse
actionProductDeleteCalled while a product is deletedid_product
actionProductOutOfStockUsed to add buttons in product.tpl when a product is out of stockproduct
actionProductSaveCalled while saving productsid_product, product
actionProductSearchCompleteCalled after a faceted search is completedlabel, products, sort_orders, pagination, rendered_facets, rendered_active_filters, js_enabled, current_url
actionProductUpdateCalled after a product has been updatedid_product, product
actionSetInvoiceCalled to modify the invoice numberOrder, OrderInvoice, use_existing_payment
actionShopDataDuplicationCalled when duplicating a shopold_id_shop, new_id_shop
actionTaxManagerCalled when calculating product tax 
actionUpdateQuantityCalled when a product quantity is updatedid_product, id_product_attribute, quantity, id_shop
actionValidateCustomerAddressFormCalled after validating the customer addressform
actionValidateOrderCalled when an order is validated by a payment modulecart, order, customer, currency, order_status
actionWatermarkCalled to add a watermark to a product imageid_image, id_product
additionalCustomerFormFieldsUsed to add fields to the customer registration form 
addWebserviceResourcesUsed to add resources to the Webserviceresources
advancedPaymentOptionsUsed to add advanced payment options 
dashboardZoneOneUsed to add a module to the left column of the dashboarddate_from, date_to
dashboardZoneTwoUsed to add a module to the right column of the dashboarddate_from, date_to
displayAdminCustomersUsed to add a block when viewing a customer in the Back Officeid_customer
displayAdminOrderUsed to add a block above the products block when viewing an order in the Back Officeid_order
displayAdminOrderContentOrderUsed to add a new tab content before the Status tab when viewing an order in the Back Officeorder, products, customer
displayAdminOrderContentShipUsed to add a new tab content before the Shipping Address tab when viewing an order in the Back Officeorder, products, customer
displayAdminOrderTabOrderUsed to add a tab before the Status tab when viewing an order in the Back Officeorder, products, customer
displayAdminOrderTabShipUsed to add a tab before the Shipping Address tab when viewing an order in the Back Officeorder, products, customer
displayAdminProductsExtraUsed to add options to the "Modules options" tab on the product editorid_module
displayAdminStatsGraphEngineUsed to add a new graph engine when rendering stats 
displayAdminStatsGridEngineUsed to add a new grid engine when rendering stats 
displayAdminStatsModulesUsed to add a new subtab to the Stats tab in the Back Office 
displayAfterBodyOpeningTagUsed to add content after the <body&rt; tag. 
displayAfterCarrierUsed to add content after the carrier list in the Front Officecart
displayAttributeFormUsed to add a new field when editing product attributesid_attribute
displayAttributeGroupFormUsed to add a new field when editing product attribute groupsid_attribute_group
displayAttributeGroupPostProcessUsed to add code to post-process when saving product attribute groupserrors (modifiable)
displayBackOfficeCategoryUsed by the "Categories block" module to add category thumbnails when editing categories 
displayBackOfficeFooterUsed to add content to the right side of the Back Office footer 
displayBackOfficeHeaderUsed to add media to the <head> tag in the Back Office 
displayBackOfficeHomeUsed to add content to the Back Office homepage 
displayBackOfficeTopUsed to add content to the right side of the Back Office header 
displayBeforeCarrierUsed to add content before the carrier list in the Front Officecart
displayBeforeBodyClosingTagUsed to add content before the <body>
displayCarrierExtraContentUsed to add content below a carrier on the checkout pagescarrier
displayCarrierListUsed to add extra carriers on the checkout pageaddress
displayCustomerAccountUsed to add links to the customer account page 
displayCustomerAccountFormUsed to add fields to the bottom of customer registration form in the Front Office 
displayCustomerAccountFormTopUsed to add fields to the top of the customer registration form in the Front Office 
displayCustomizationUsed to override the a customization valuecustomization
displayFeatureFormUsed to add fields when editing product featuresid_feature
displayFeaturePostProcessUsed to add code to post-process when saving product featureserrors (modifiable)
displayFeatureValueFormUsed to add fields when editing product feature valuesid_feature_value
displayFeatureValuePostProcessUsed to add code to post-process when saving product feature valueserrors (modifiable)
displayFooterUsed to add blocks to the footer in the Front Office 
displayFooterProductUsed to add blocks on the product page under the descriptionproduct, category
displayHomeUsed to add blocks to the homepage in the Front Office 
displayInvoiceUsed to add content to the top of the order page in the Back Officeid_order
displayInvoiceLegalFreeTextUsed to modify the legal free text on PDF invoicesid_order
displayLeftColumnUsed to add blocks to the left column in the Front Office 
displayLeftColumnProductUsed to add content to the left column of the product page in the Front Office 
displayMaintenanceUsed to add content below the logo on the maintenance page 
displayMyAccountBlockUsed to add links to the "My account block" in the left or right column 
displayNavUsed to add content to the navigation bar at the top of the Front Office 
displayNavFullWidthUsed to add a full width navigation menu at the top of the page 
displayOrderConfirmationCalled before the order confirmation page is displayedorder
displayOrderDetailUsed to add content above the products in the order detail in the Front Officeorder
displayOverrideTemplateUsed to override the template of the current Front Office controllercontroller
displayPaymentEUUsed to add EU payment options 
displayPaymentReturnUsed to add code before the payment return page is displayedorder
displayPaymentTopUsed to add content to the top of the payment page 
displayPDFInvoiceUsed to add content to the bottom of PDF invoicesobject
displayProductButtonsUsed to add action buttons to the product page in the Front Officeproduct
displayProductExtraContentUsed to add tabs and content to the product pageproducts
displayProductListFunctionalButtonsUsed to add buttons to each product in listings in the Front Officeproduct
displayRightColumnUsed to add blocks to the right column in the Front Officecart
displayRightColumnProductUsed to add content to the right column of the product page in the Front Office 
displayShoppingCartUsed to add additional action buttons to the shopping cart on the checkout page delivery, delivery_state, invoice, invoice_state, formattedAddresses, products, gift_products, discounts, is_virtual_cart, total_discounts, total_discounts_tax_exc, total_wrapping, total_wrapping_tax_exc, total_shipping, total_shipping_tax_exc, total_products_wt, total_products, total_price, total_tax, total_price_without_tax, is_multi_address_delivery, free_ship, carrier
displayShoppingCartFooterUsed to add content below the shopping cart on the checkout pagedelivery, delivery_state, invoice, invoice_state, formattedAddresses, products, gift_products, discounts, is_virtual_cart, total_discounts, total_discounts_tax_exc, total_wrapping, total_wrapping_tax_exc, total_shipping, total_shipping_tax_exc, total_products_wt, total_products, total_price, total_tax, total_price_without_tax, is_multi_address_delivery, free_ship, carrier
displayTopUsed to add content to the top of the page in the Front Office 
displayTopColumnUsed to add content to the top of the center column in the Front Office 
HeaderUsed to add media to the <head> tag in the Front Office 
overrideMinimalPurchasePriceUsed to override the minimum purchase priceminimalPurchase (modifiable)
paymentOptionsUsed to add a payment option to the checkout page 
termsAndConditionsUsed to add terms and conditions to the checkout page 
updateProductCalled after updating a productid_product
validateCustomerFormFieldsUsed to validate customer form fields the module has createdfields