Skip to main content
Here you can find a list of helper methods provided by Spree that are available in the Storefront. These methods can be used in every template.

Context Helpers

current_store

Spree::Store
Returns the current store Spree::Store instance.

current_theme

Spree::Theme
Returns the current theme Spree::Theme instance.

current_page

Returns the current Spree::Page instance for the current route.

current_order

Spree::Order
Returns the current order object. If no order is found, it will return nil.
Order is automatically created when a user adds a product to the cart.

try_spree_current_user

Spree.user_class
Returns the current user object (class depends on the Spree.user_class configuration). If the user is not signed in, it will return nil.
If you want to check if the user is signed in, you can use the following:

current_currency

Returns the currently selected currency. By default in the Storefront this will be store.default_currency. This can be changed in the Settings -> Store Defaults page.
will return

current_locale

Returns the currently selected locale. By default in the Storefront this will be store.default_locale. This can be changed in the Settings -> Store Defaults page. If there are multiple locales available, it will return the locale that is currently selected by the user.
Locale also affects the storefront URLs. For example, if the default locale is en and the user selects fr, the URL will be /fr/products/123.

current_taxon

Returns the current taxon when viewing a category/collection page.

current_wishlist

Returns the current user’s default wishlist for the current store.

Page Rendering Helpers

render_page

Renders a page with all its sections. This is the main method for rendering page content.
Parameters:
  • page - The page to render (defaults to current_page)
  • variables - Hash of variables to pass to section templates

render_section

Renders a single section.

render_header_sections

Renders all header sections (announcement bar, header).
Renders all footer sections (newsletter, footer).

Section & Block Helpers

section_styles

Returns inline CSS styles for a section based on its preferences (padding, colors, borders).

block_attributes

Returns data attributes for a block (used for Page Builder editing).

page_builder_enabled?

Returns true when the page is being viewed in Page Builder preview mode.
Renders a link from a Spree::PageLink object.

Currency & Price Helpers

supported_currencies

Returns the list of supported currencies for the current store as an array of strings.
will return

display_price

Displays a formatted price with currency symbol.

Date & Time Helpers

local_time

Displays a time in the user’s timezone in a human readable format (based on the browser’s timezone).
Provided by local_time gem.

URL Helpers

spree_storefront_resource_url

Generates a URL for a Spree resource (product, taxon, post, page).

spree.nested_taxons_path

Generates a URL for a taxon using its full permalink.

Image Helpers

spree_image_tag

Renders an optimized image tag with automatic WebP conversion and retina support.

spree_image_url

Generates a URL for an image with specified dimensions.
See Media for more details on image helpers.

Product Helpers

taxon_products

Returns products for a given taxon, useful in section templates.

storefront_products

Returns products based on current filters and sorting.

Cache Helpers

spree_storefront_base_cache_key

Returns the base cache key for storefront caching.

spree_storefront_base_cache_scope

Returns a cache scope proc for section caching.

Preview Helpers

These helpers are used for Page Builder preview functionality:
  • Sections - Section rendering and customization
  • Blocks - Block rendering
  • Media - Image helper methods