Skip to main content
Spree Admin Dashboard allows you to easily extend existing pages and screens with your own code, without any need to modify the core codebase. This allows you to easily inject your custom UI elements without compromising the integrity of the core codebase. Which in effect allows you to safely update your Spree installation to the latest version.

How it works

The entire system works on the basis of injection points which are declared throughout the admin dashboard and allows you to push your own code there. Each injection point is identified by a key, eg. body_end. Let’s say you want to add a new footer to the admin dashboard. You’ll need to generate a template in your application:
  1. Ensure you have the proper directory to store your templates:
  2. Create a new partial template file (partial templates file names start with underscore)
  3. Add your own code to the partial
  4. Register your partial in config/initializers/spree.rb
    config/initializers/spree.rb
    The key is the name of the injection point, eg. body_end.
    Remember to use the correct path to your template file and skip the _ prefix.
  5. Restart your web server and you should see your new footer.
    Making further changes to the partial template will not require you to restart the web server. They will be picked up automatically.

Partials API

The Spree.admin.partials object provides a clean API for registering partials to injection points. This API is available in Spree 5.2 and later.

Accessing Available Injection Points

You can list all available injection points programmatically:

Registering Partials

Each injection point is an array that you can append to:
config/initializers/spree.rb

Viewing Registered Partials

To see which partials are registered for a specific injection point:

Replacing All Partials

You can also replace all partials for an injection point:
Replacing all partials will remove any partials registered by other extensions. Use this with caution.

List of all injection points

Here’s a list of all places you can inject your custom code:

Layout

headInjects code into the <head> tag
body_startInjects code into the <body> tag, before the main content
body_endInjects code into the <body> tag, after the main content

Dashboard

dashboard_analytics
Injects code into the dashboard analytics section, eg.

Orders

orders_actionsInjects code into the page actions area (top right of the page) for the orders list page. This is useful for adding custom buttons, export options, or other actions.
orders_headerInjects code between the page header and the main content area for the orders list page. This is useful for adding notifications, alerts, or additional information.
orders_filters

Variables

f
Spree::Admin::FormBuilder
Injects code into the orders list filters, to add custom filters. This partial has access to the f variable, which is the form builder for the filters, eg.
  • q_number_cont - The name of the filter field. For filtering we’re using ransack gem, so the name of the filter field is the name of the attribute we’re filtering by.
  • data: { filters_target: :input } - Needed for the Stimulus Filters controller to work.
order_page_dropdown

Variables

order
Spree::Order
The Spree::Order object.
Injects code into the order page dropdown. This partial has access to the order variable.To add an additional dropdown item, you can use the following code:
  • dropdown-item is a CSS class for styling the dropdown item
  • target: "_blank" is used to open the link in a new tab
order_page_header

Variables

order
Spree::Order
The Spree::Order object.
Injects code into the order page header.To add an additional action button near the ... button, you can use the following code:
Injects code into the order page header.To add an additional action button near the ... button, you can use the following code:
To add an inline alert to the order page, you can use the following code:
local_time is a helper for displaying the time in the user’s timezone in a human readable format (based on the browser’s timezone).
order_page_body

Variables

order
Spree::Order
The Spree::Order object.
Injects code into the order page body. This partial has access to the order variable.To add a new section to the order page, you can use the following code:
order_page_sidebar

Variables

order
Spree::Order
The Spree::Order object.
Injects code into the order page sidebar. This partial has access to the order variable.

Customers

users_actionsInjects code into the page actions area (top right of the page) for the customers list page. This is useful for adding custom buttons, export options, or other actions.
users_headerInjects code between the page header and the main content area for the customers list page. This is useful for adding notifications, alerts, or additional information.
users_filters

Variables

f
ActionView::Helpers::FormBuilder
Injects code into the customers list filters. This partial has access to the f variable, which is the form builder for the filters.
  • Use ransack search syntax for filter field names
  • Include data: { filters_target: :input } for proper integration with the Stimulus Filters controller

Stock Items

stock_items_actionsInjects code into the page actions area for the stock items list page.
stock_items_headerInjects code between the page header and the main content area for the stock items list page.
stock_items_filters

Variables

f
Spree::Admin::FormBuilder
Injects code into the stock items list filters.
Use ransack search syntax for filter field names (e.g., _lt for “less than”).

Admin Users

admin_users_actionsInjects code into the page actions area for the admin users list page.
admin_users_headerInjects code between the page header and the main content area for the admin users list page.

Classifications

classifications_actionsInjects code into the page actions area for the classifications list page.
classifications_headerInjects code between the page header and the main content area for the classifications list page.

Coupon Codes

coupon_codes_actionsInjects code into the page actions area for the coupon codes list page.
coupon_codes_headerInjects code between the page header and the main content area for the coupon codes list page.

Customer Returns

customer_returns_actionsInjects code into the page actions area for the customer returns list page.
customer_returns_headerInjects code between the page header and the main content area for the customer returns list page.
customer_returns_filters

Variables

f
Spree::Admin::FormBuilder
Injects code into the customer returns list filters.
Use ransack search syntax for filter field names (e.g., _eq for “equals”).

Digital Assets

digital_assets_actionsInjects code into the page actions area for the digital assets list page.
digital_assets_headerInjects code between the page header and the main content area for the digital assets list page.

Exports

exports_actionsInjects code into the page actions area for the exports list page.
exports_headerInjects code between the page header and the main content area for the exports list page.

Gift Cards

gift_cards_actionsInjects code into the page actions area for the gift cards list page.
gift_cards_headerInjects code between the page header and the main content area for the gift cards list page.
gift_cards_filters

Variables

f
Spree::Admin::FormBuilder
Injects code into the gift cards list filters.
Use ransack search syntax for filter field names (e.g., _gt for “greater than”).

Integrations

integrations_actionsInjects code into the page actions area for the integrations list page.
integrations_headerInjects code between the page header and the main content area for the integrations list page.

Invitations

invitations_actionsInjects code into the page actions area for the invitations list page.
invitations_headerInjects code between the page header and the main content area for the invitations list page.

Option Types

option_types_actionsInjects code into the page actions area for the option types list page.
option_types_headerInjects code between the page header and the main content area for the option types list page.

Pages

pages_actionsInjects code into the page actions area for the pages list page.
pages_headerInjects code between the page header and the main content area for the pages list page.

Payment Methods

payment_methods_actionsInjects code into the page actions area for the payment methods list page.
payment_methods_headerInjects code between the page header and the main content area for the payment methods list page.

Promotions

promotions_actionsInjects code into the page actions area for the promotions list page.
promotions_headerInjects code between the page header and the main content area for the promotions list page.
promotions_filters

Variables

f
Spree::Admin::FormBuilder
Injects code into the promotions list filters.
Use ransack search syntax for filter field names.

Properties

properties_actionsInjects code into the page actions area for the properties list page.
properties_headerInjects code between the page header and the main content area for the properties list page.

Refund Reasons

refund_reasons_actionsInjects code into the page actions area for the refund reasons list page.
refund_reasons_headerInjects code between the page header and the main content area for the refund reasons list page.

Reimbursement Types

reimbursement_types_actionsInjects code into the page actions area for the reimbursement types list page.
reimbursement_types_headerInjects code between the page header and the main content area for the reimbursement types list page.

Reports

reports_actionsInjects code into the page actions area for the reports list page.
reports_headerInjects code between the page header and the main content area for the reports list page.

Return Authorization Reasons

return_authorization_reasons_actionsInjects code into the page actions area for the return authorization reasons list page.
return_authorization_reasons_headerInjects code between the page header and the main content area for the return authorization reasons list page.

Return Authorizations

return_authorizations_actionsInjects code into the page actions area for the return authorizations list page.
return_authorizations_headerInjects code between the page header and the main content area for the return authorizations list page.

Roles

roles_actionsInjects code into the page actions area for the roles list page.
roles_headerInjects code between the page header and the main content area for the roles list page.

Shipping Categories

shipping_categories_actionsInjects code into the page actions area for the shipping categories list page.
shipping_categories_headerInjects code between the page header and the main content area for the shipping categories list page.

Shipping Methods

shipping_methods_actionsInjects code into the page actions area for the shipping methods list page.
shipping_methods_headerInjects code between the page header and the main content area for the shipping methods list page.

Stock Locations

stock_locations_actionsInjects code into the page actions area for the stock locations list page.
stock_locations_headerInjects code between the page header and the main content area for the stock locations list page.

Stock Transfers

stock_transfers_actionsInjects code into the page actions area for the stock transfers list page.
stock_transfers_headerInjects code between the page header and the main content area for the stock transfers list page.
stock_transfers_filters

Variables

f
Spree::Admin::FormBuilder
Injects code into the stock transfers list filters.
Use ransack search syntax for filter field names.

Store Credit Categories

store_credit_categories_actionsInjects code into the page actions area for the store credit categories list page.
store_credit_categories_headerInjects code between the page header and the main content area for the store credit categories list page.

Store Credits

store_credits_actionsInjects code into the page actions area for the store credits list page.
store_credits_headerInjects code between the page header and the main content area for the store credits list page.

Tax Categories

tax_categories_actionsInjects code into the page actions area for the tax categories list page.
tax_categories_headerInjects code between the page header and the main content area for the tax categories list page.

Tax Rates

tax_rates_actionsInjects code into the page actions area for the tax rates list page.
tax_rates_headerInjects code between the page header and the main content area for the tax rates list page.

Taxonomies

taxonomies_actionsInjects code into the page actions area for the taxonomies list page.
taxonomies_headerInjects code between the page header and the main content area for the taxonomies list page.

Webhooks Subscribers

webhooks_subscribers_actionsInjects code into the page actions area for the webhooks subscribers list page.
webhooks_subscribers_headerInjects code between the page header and the main content area for the webhooks subscribers list page.

Zones

zones_actionsInjects code into the page actions area for the zones list page.
zones_headerInjects code between the page header and the main content area for the zones list page.

Products

products_actionsInjects code into the page actions area (top right of the page) for the products list page. This is useful for adding custom buttons, export options, or other actions.
products_headerInjects code between the page header and the main content area for the products list page. This is useful for adding notifications, alerts, or additional information.
products_filters

Variables

f
Spree::Admin::FormBuilder
Injects code into the products list filters. This partial has access to the f variable, which is the form builder for the filters.To add a new filter field, you can use the following code:
  • q_name_cont is the name of the filter field. For filtering we’re using ransack gem, so the name of the filter field is the name of the attribute we’re filtering by.
  • data: { filters_target: :input } is needed for the Stimulus Filters controller to work.
product_dropdown
Injects code into the products page dropdown. This partial has access to the product variable.To add an additional dropdown item, you can use the following code:
Your code will be placed before the dropdown divider.
product_form

Variables

f
Spree::Admin::FormBuilder
product
Spree::Product
The Spree::Product object.
Injects code into the product form. This partial has access to the f variable, which is the form builder for the product form, and the product variable.To add a new section to the product form, you can use the following code:
The partial will be displayed for both new product form and edit product form.
If you want to display the partial only on the edit product form, you can use the following code:
And similarly for the new product form.
product_form_sidebar

Variables

f
Spree::Admin::FormBuilder
product
Spree::Product
The Spree::Product object.
Injects code into the product form sidebar. This partial has access to the f variable, which is the form builder for the product form, and the product variable.To add a new section to the product form sidebar, you can use the following code:
The partial will be displayed for both new product form and edit product form.
If you want to display the partial only on the edit product form, you can use the following code:
And similarly for the new product form.

Shipping Methods

shipping_method_form

Variables

f
Spree::Admin::FormBuilder
shipping_method
Spree::ShippingMethod
Injects code into the shipping method form. This partial has access to the f variable, which is the form builder for the shipping method form, and the shipping_method variable.To add a new section to the shipping method form, you can use the following code:

Store Settings

store_form

Variables

f
Spree::Admin::FormBuilder
store
Spree::Store
The Spree::Store object.
Injects code into the store settings form. This partial has access to the f variable, which is the form builder for the store form, and the store variable.To add a new section to the store form, you can use the following code: