Template Hooks

Commerce adds its own template hooks in addition to Craft’s. Some hooks are not suitable for injecting HTML, but can still be used to modify data available to the rest of the template.

# Discounts

cp.commerce.discount.edit

After discount detail view’s “Enabled” field.

store-management/discounts/_edit.twig (opens new window)

cp.commerce.discounts.edit.content

After discount detail view’s main content.

store-management/discounts/_edit.twig (opens new window)

cp.commerce.discounts.edit.details

After discount detail view’s existing right sidebar details column.

store-management/discounts/_edit.twig (opens new window)

cp.commerce.discounts.edit

Before discount detail view’s template blocks. HTML not allowed.

store-management/discounts/_edit.twig (opens new window)

cp.commerce.discounts.index

After discounts index view’s main content.

store-management/discounts/index.twig (opens new window)

# Orders

cp.commerce.order.edit

Before order edit view’s template blocks. HTML not allowed.

orders/_edit.twig (opens new window)

cp.commerce.order.edit.details

After existing order edit view’s right sidebar details.

orders/_edit.twig (opens new window)

cp.commerce.order.edit.main-pane

After existing content within order edit view’s “Order Details” tab.

orders/_edit.twig (opens new window)

cp.commerce.order.edit.order-actions

Inject additional controls just before the primary order form actions in the page toolbar.

orders/_edit.twig (opens new window)

cp.commerce.order.edit.order-secondary-actions

Inject additional controls just before the secondary order form actions in the page toolbar.

orders/_edit.twig (opens new window)

# Sales

Note that sales are a legacy feature and may not be available to all Commerce users.

cp.commerce.sales.edit.content

After sale detail view’s main content.

promotions/sales/_edit.twig (opens new window)

cp.commerce.sales.edit.details

After sale detail view’s existing right sidebar details column.

promotions/sales/_edit.twig (opens new window)

cp.commerce.sales.edit

Before sale detail view’s template blocks. HTML not allowed.

promotions/sales/_edit.twig (opens new window)

cp.commerce.sales.index

After sales index view’s main content.

promotions/sales/index.twig (opens new window)

# Subscriptions

cp.commerce.subscriptions.edit.content

After the last .pane in subscription detail view’s content block.

subscriptions/_edit.twig (opens new window)

cp.commerce.subscriptions.edit.meta

After the right sidebar details on subscription elements’ edit screen.

subscriptions/_edit.twig (opens new window)

# Inventory + Locations

cp.commerce.inventory.index

After the table containing inventory levels for a specific inventory location.

inventory/levels/_index.twig (opens new window)

cp.commerce.inventoryLocation.edit

After address fields in the inventory location edit screen.

inventory-locations/_edit.twig (opens new window)

# Pricing Catalog

cp.commerce.catalogPricingRules.index

After the table containing a store’s pricing rules.

store-management/pricing-rules/index.twig (opens new window)

cp.commerce.catalogPricingRules.edit.content

After the tabbed pricing rule configuration UI. Content injected here will always be visible, regardless of the selected tab.

store-management/pricing-rules/_edit.twig (opens new window)

# Shipping

cp.commerce.shippingMethods.edit.content

After the shipping rule form.

store-management/shipping/shipping-methods/_edit.twig (opens new window)