Skip to main content

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
Returns:
String - Formatted price string with currency symbol
Example:
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:
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:
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:
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:
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:
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:
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:
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:
Use Cases:
  • Setting default quantities
  • Fallback text
  • Configuration defaults
  • Error prevention

Error Handling

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