format_money

Description:
Formats numeric values into the store’s currency format based on the money_format setting from the glood object.

Parameters:

  • value (Number/String): The numeric price value to be formatted
  • money_format (String): Override default money format
  • intl_options (Object, optional): Currency formatting configuration
      {
        "en":   {
          style: 'currency',
          currency: 'USD',
          minimumFractionDigits: 2,
          maximumFractionDigits: 2
        }
      }
    

Returns:
String - Formatted price string with currency symbol

Example:

{{ product.price | format_money: glood.shop.money_format, template.settings.intl_options }}

Use Cases:

  • Formatting product prices
  • Displaying compare at prices
  • Showing discount amounts
  • Bundle total prices

optimize_image

Description:
Optimizes and resizes images for better performance using CDN parameters.

Parameters:

  • url (String): The original image URL to be optimized
  • width (Number, optional): Desired image width
  • height (Number, optional): Desired image height
  • crop (String, optional): Crop mode for the image

Returns:
String - Optimized image URL with CDN parameters

Example:

{{ product.featured_image.src | optimize_image: width: 300, height: 300 }}
{{ product.image | optimize_image: width: 600, height: 600, crop: 'center' }}

Use Cases:

  • Product card images
  • Responsive image loading
  • Thumbnail generation
  • Banner image optimization

product_url

Description:
Generates a complete product URL with tracking parameters and localization.

Parameters:

  • handle (String, required): Product handle/slug
  • ref_product_id (String, optional): Reference product ID
  • layout (String, optional): Section layout type

Returns:
String - Complete product URL with parameters

Example:

{% assign url = root_url | product_url: product.handle, glood.product.id, section.layout %}
<a href="{{ url }}">{{ product.title }}</a>

Use Cases:

  • Product link generation
  • Navigation building
  • Tracking implementation
  • Multi-language support

product_discount

Description:
Calculates and formats product discount information based on configuration.

Parameters:

  • discount_config (Object, required): Discount configuration settings
  • label_text (String, required): Template for discount label
  • money_format (String, required): Store’s money format
  • intl_options (Object, optional): Currency formatting configuration

Returns:
String - Formatted discount text

Example:

{% assign discount = product | product_discount: section.discount_config, translations.discount_label_text, glood.shop.money_format, template.settings.intl_options %}
<span class="discount">{{ discount }}</span>

Use Cases:

  • Sale badges
  • Discount displays
  • Price comparison
  • Promotional messaging

save_amount

Description:
Calculates and formats savings information based on discount configuration.

Parameters:

  • discount_config (Object, required): Discount configuration settings
  • save_text (String, required): Template for savings text
  • money_format (String, required): Store’s money format
  • intl_options (Object, optional): Currency formatting configuration

Returns:
String - Formatted savings text

Example:

{{ product | save_amount: section.discount_config, translations.discount_save_text, glood.shop.money_format, template.settings.intl_options }}

Use Cases:

  • Savings displays
  • Discount comparison
  • Promotional messaging

color_value

Description:
Retrieves color code from a color map object.

Parameters:

  • color_mapping (Object, required): Color map object

Returns:
String - Color code

Example:

{{ value | color_value: template.settings.color_mapping }}

Use Cases:

  • Theme customization
  • Product attribute mapping
  • UI element styling

to_boolean

Description:
Converts any value to a boolean.

Parameters:

  • None

Returns:
Boolean - True or False

Example:

<span data-selected="{{ selected_option.value == value | to_boolean }}">

Use Cases:

  • Conditional rendering
  • Boolean logic
  • UI state management

image_dimensions

Description:
Calculates responsive image dimensions based on template breakpoint settings.

Parameters:

  • breakpoints (Object, required): Template breakpoint settings

Returns:
Object - Object containing calculated dimensions

Example:

{{ client_info.client_width | image_dimensions: template.settings.breakpoints }}

Use Cases:

  • Responsive image loading
  • UI element sizing
  • Image optimization

default

Description:
Provides a default value if the input is null, undefined or empty.

Parameters:

  • default_value (Any, required): Value to use if input is empty

Returns:
Any - Original value or default value

Example:

{{ template.settings.product_card.min_quantity | default: 1 }}
{{ translations.oos_text | default: 'Out of stock' }}

Use Cases:

  • Setting default quantities
  • Fallback text
  • Configuration defaults
  • Error prevention

Error Handling

ErrorDescriptionSolution
Invalid Price FormatPrice value is null or not a number1. Use the default filter to set a fallback value (0)
2. Apply money filter to format the price
Missing Image DimensionsWidth/height not specified for image optimization1. Always specify width and height parameters
2. Use default dimensions (300x300) if not provided
Invalid Tracking ParametersMissing required section context1. Check if section ID exists
2. Verify product handle is present
3. Fall back to standard product URL if missing
Invalid Discount ConfigurationMissing money format or invalid discount structure1. Ensure shop money format is provided
2. Validate discount configuration before applying

These errors require proper handling to:

  • Prevent template rendering failures
  • Maintain consistent price display
  • Ensure proper image loading
  • Keep tracking functionality intact

Notes

  • All filters are available in both section templates and CSS templates
  • Some filters require specific objects from the template context
  • Filter parameters marked as required must be provided for the filter to work correctly
  • See Object Definitions for details about input objects

Support

For help with template customization or troubleshooting, contact our support team at support@glood.ai

Was this page helpful?