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 formattedmoney_format(String): Override default money formatintl_options(Object, optional): Currency formatting configuration
String - Formatted price string with currency symbol Example:
- 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 optimizedwidth(Number, optional): Desired image widthheight(Number, optional): Desired image heightcrop(String, optional): Crop mode for the image
String - Optimized image URL with CDN parameters Example:
- 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/slugref_product_id(String, optional): Reference product IDlayout(String, optional): Section layout type
String - Complete product URL with parameters Example:
- 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 settingslabel_text(String, required): Template for discount labelmoney_format(String, required): Store’s money formatintl_options(Object, optional): Currency formatting configuration
String - Formatted discount text Example:
- 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 settingssave_text(String, required): Template for savings textmoney_format(String, required): Store’s money formatintl_options(Object, optional): Currency formatting configuration
String - Formatted savings text Example:
- 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
String - Color code Example:
- Theme customization
- Product attribute mapping
- UI element styling
to_boolean
Description:Converts any value to a boolean. Parameters:
- None
Boolean - True or False Example:
- 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
Object - Object containing calculated dimensions Example:
- 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
Any - Original value or default value Example:
- Setting default quantities
- Fallback text
- Configuration defaults
- Error prevention
Error Handling
| Error | Description | Solution |
|---|---|---|
| Invalid Price Format | Price value is null or not a number | 1. Use the default filter to set a fallback value (0) 2. Apply money filter to format the price |
| Missing Image Dimensions | Width/height not specified for image optimization | 1. Always specify width and height parameters 2. Use default dimensions (300x300) if not provided |
| Invalid Tracking Parameters | Missing required section context | 1. Check if section ID exists 2. Verify product handle is present 3. Fall back to standard product URL if missing |
| Invalid Discount Configuration | Missing money format or invalid discount structure | 1. Ensure shop money format is provided 2. Validate discount configuration before applying |
- 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