@zohofinance/commerce 1.0.0 → 1.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (127) hide show
  1. package/README.md +61 -0
  2. package/package.json +2 -2
  3. package/ts-dist/mocks/init-theme/.claude/CLAUDE.md +6 -0
  4. package/ts-dist/mocks/init-theme/.claude/skills/.archive/zcommerce-section-from-design.20260528/SKILL.md +242 -0
  5. package/ts-dist/mocks/init-theme/.claude/skills/.archive/zcommerce-section-from-design.20260528/inputs/figma.md +81 -0
  6. package/ts-dist/mocks/init-theme/.claude/skills/.archive/zcommerce-section-from-design.20260528/inputs/screenshot.md +54 -0
  7. package/ts-dist/mocks/init-theme/.claude/skills/.archive/zcommerce-section-from-design.20260528/inputs/url.md +88 -0
  8. package/ts-dist/mocks/init-theme/.claude/skills/.archive/zcommerce-section-from-design.20260528/spec-table.md +102 -0
  9. package/ts-dist/mocks/init-theme/.claude/skills/.archive/zcommerce-section-from-design.20260528/verification/accessibility.md +110 -0
  10. package/ts-dist/mocks/init-theme/.claude/skills/.archive/zcommerce-section-from-design.20260528/verification/performance.md +127 -0
  11. package/ts-dist/mocks/init-theme/.claude/skills/.archive/zcommerce-section-from-design.20260528/verification/tokens.md +87 -0
  12. package/ts-dist/mocks/init-theme/.claude/skills/.archive/zcommerce-section-from-design.20260528/verification/visual-diff.md +123 -0
  13. package/ts-dist/mocks/init-theme/.claude/skills/.archive/zcommerce-theme-builder.20260528/SKILL.md +605 -0
  14. package/ts-dist/mocks/init-theme/.claude/skills/.archive/zcommerce-theme-builder.20260528/design-tokens.md +105 -0
  15. package/ts-dist/mocks/init-theme/.claude/skills/.archive/zcommerce-theme-builder.20260528/page-json-contract.md +58 -0
  16. package/ts-dist/mocks/init-theme/.claude/skills/.archive/zcommerce-theme-builder.20260528/qa-accessibility.md +35 -0
  17. package/ts-dist/mocks/init-theme/.claude/skills/.archive/zcommerce-theme-builder.20260528/reference-lookup.md +94 -0
  18. package/ts-dist/mocks/init-theme/.claude/skills/.archive/zcommerce-theme-builder.20260528/section-anatomy.md +109 -0
  19. package/ts-dist/mocks/init-theme/.claude/skills/theme-from-figma/SKILL.md +313 -0
  20. package/ts-dist/mocks/init-theme/.claude/skills/theme-from-figma/agent-hierarchy.md +142 -0
  21. package/ts-dist/mocks/init-theme/.claude/skills/theme-from-figma/ask-developer.md +113 -0
  22. package/ts-dist/mocks/init-theme/.claude/skills/theme-from-figma/bootstrap.md +260 -0
  23. package/ts-dist/mocks/init-theme/.claude/skills/theme-from-figma/build-metrics.md +89 -0
  24. package/ts-dist/mocks/init-theme/.claude/skills/theme-from-figma/code-quality.md +186 -0
  25. package/ts-dist/mocks/init-theme/.claude/skills/theme-from-figma/common-pages-agent.md +97 -0
  26. package/ts-dist/mocks/init-theme/.claude/skills/theme-from-figma/dev-server-and-urls.md +127 -0
  27. package/ts-dist/mocks/init-theme/.claude/skills/theme-from-figma/exemplars.md +79 -0
  28. package/ts-dist/mocks/init-theme/.claude/skills/theme-from-figma/figma-discovery.md +138 -0
  29. package/ts-dist/mocks/init-theme/.claude/skills/theme-from-figma/figma-extraction.md +132 -0
  30. package/ts-dist/mocks/init-theme/.claude/skills/theme-from-figma/image-sources.md +84 -0
  31. package/ts-dist/mocks/init-theme/.claude/skills/theme-from-figma/inputs/guidelines-frame.md +178 -0
  32. package/ts-dist/mocks/init-theme/.claude/skills/theme-from-figma/page-builder.md +322 -0
  33. package/ts-dist/mocks/init-theme/.claude/skills/theme-from-figma/page-orchestrator.md +199 -0
  34. package/ts-dist/mocks/init-theme/.claude/skills/theme-from-figma/parallel-fanout.md +152 -0
  35. package/ts-dist/mocks/init-theme/.claude/skills/theme-from-figma/scripts/a11y.mjs +129 -0
  36. package/ts-dist/mocks/init-theme/.claude/skills/theme-from-figma/scripts/lint-section.mjs +502 -0
  37. package/ts-dist/mocks/init-theme/.claude/skills/theme-from-figma/scripts/perf.mjs +134 -0
  38. package/ts-dist/mocks/init-theme/.claude/skills/theme-from-figma/scripts/pixel-diff.mjs +206 -0
  39. package/ts-dist/mocks/init-theme/.claude/skills/theme-from-figma/scripts/record-build-metrics.mjs +118 -0
  40. package/ts-dist/mocks/init-theme/.claude/skills/theme-from-figma/section-builder.md +131 -0
  41. package/ts-dist/mocks/init-theme/.claude/skills/theme-from-figma/subagent-escalation.md +75 -0
  42. package/ts-dist/mocks/init-theme/.claude/skills/theme-from-figma/transcription-rules.md +98 -0
  43. package/ts-dist/mocks/init-theme/.claude/skills/theme-from-figma/verification.md +227 -0
  44. package/ts-dist/mocks/init-theme/.claude/skills/theme-from-figma/visual-verify-loop.md +117 -0
  45. package/ts-dist/mocks/init-theme/.claude/skills/theme-from-figma/zcommerce-docs/_index.md +4 -0
  46. package/ts-dist/mocks/init-theme/.claude/skills/theme-from-figma/zcommerce-docs/assets.md +105 -0
  47. package/ts-dist/mocks/init-theme/.claude/skills/theme-from-figma/zcommerce-docs/best-practices.md +212 -0
  48. package/ts-dist/mocks/init-theme/.claude/skills/theme-from-figma/zcommerce-docs/custom-scripts.md +294 -0
  49. package/ts-dist/mocks/init-theme/.claude/skills/theme-from-figma/zcommerce-docs/i18n.md +155 -0
  50. package/ts-dist/mocks/init-theme/.claude/skills/theme-from-figma/zcommerce-docs/introduction.md +91 -0
  51. package/ts-dist/mocks/init-theme/.claude/skills/theme-from-figma/zcommerce-docs/layouts.md +158 -0
  52. package/ts-dist/mocks/init-theme/.claude/skills/theme-from-figma/zcommerce-docs/pages.md +156 -0
  53. package/ts-dist/mocks/init-theme/.claude/skills/theme-from-figma/zcommerce-docs/reference/_index.md +4 -0
  54. package/ts-dist/mocks/init-theme/.claude/skills/theme-from-figma/zcommerce-docs/reference/filters.md +419 -0
  55. package/ts-dist/mocks/init-theme/.claude/skills/theme-from-figma/zcommerce-docs/reference/global-objects.md +415 -0
  56. package/ts-dist/mocks/init-theme/.claude/skills/theme-from-figma/zcommerce-docs/reference/schema-types.md +926 -0
  57. package/ts-dist/mocks/init-theme/.claude/skills/theme-from-figma/zcommerce-docs/reference/tags.md +259 -0
  58. package/ts-dist/mocks/init-theme/.claude/skills/theme-from-figma/zcommerce-docs/sections.md +203 -0
  59. package/ts-dist/mocks/init-theme/.claude/skills/theme-from-figma/zcommerce-docs/setup-guide.md +424 -0
  60. package/ts-dist/mocks/init-theme/.claude/skills/theme-from-figma/zcommerce-docs/snippets.md +70 -0
  61. package/ts-dist/mocks/init-theme/.claude/skills/theme-from-figma/zcommerce-docs/theme-structure.md +252 -0
  62. package/ts-dist/mocks/init-theme/.cursor/PLAYBOOK.md +144 -0
  63. package/ts-dist/mocks/init-theme/.cursor/README.md +6 -0
  64. package/ts-dist/mocks/init-theme/.cursor/agents/figma-desktop-mobile-parallel.md +48 -0
  65. package/ts-dist/mocks/init-theme/.cursor/agents/visual-compare.md +221 -0
  66. package/ts-dist/mocks/init-theme/.cursor/commands/add-field.md +83 -0
  67. package/ts-dist/mocks/init-theme/.cursor/commands/add-theme-setting.md +200 -0
  68. package/ts-dist/mocks/init-theme/.cursor/commands/assemble-page.md +72 -0
  69. package/ts-dist/mocks/init-theme/.cursor/commands/audit-page.md +57 -0
  70. package/ts-dist/mocks/init-theme/.cursor/commands/build-page-sections.md +110 -0
  71. package/ts-dist/mocks/init-theme/.cursor/commands/build-section.md +418 -0
  72. package/ts-dist/mocks/init-theme/.cursor/commands/build-theme.md +307 -0
  73. package/ts-dist/mocks/init-theme/.cursor/commands/compare-section.md +358 -0
  74. package/ts-dist/mocks/init-theme/.cursor/commands/create-theme.md +77 -0
  75. package/ts-dist/mocks/init-theme/.cursor/commands/extract-tokens.md +43 -0
  76. package/ts-dist/mocks/init-theme/.cursor/commands/fix-section.md +92 -0
  77. package/ts-dist/mocks/init-theme/.cursor/commands/impact.md +50 -0
  78. package/ts-dist/mocks/init-theme/.cursor/commands/qa-a11y.md +66 -0
  79. package/ts-dist/mocks/init-theme/.cursor/commands/qa-i18n.md +110 -0
  80. package/ts-dist/mocks/init-theme/.cursor/commands/qa-layout.md +127 -0
  81. package/ts-dist/mocks/init-theme/.cursor/commands/qa-performance.md +72 -0
  82. package/ts-dist/mocks/init-theme/.cursor/commands/qa-section.md +84 -0
  83. package/ts-dist/mocks/init-theme/.cursor/commands/qa-sections.md +48 -0
  84. package/ts-dist/mocks/init-theme/.cursor/commands/qa-theme.md +85 -0
  85. package/ts-dist/mocks/init-theme/.cursor/commands/redesign-section.md +177 -0
  86. package/ts-dist/mocks/init-theme/.cursor/commands/refactor-section.md +185 -0
  87. package/ts-dist/mocks/init-theme/.cursor/commands/sync-theme-settings.md +132 -0
  88. package/ts-dist/mocks/init-theme/.cursor/commands/validate-page.md +60 -0
  89. package/ts-dist/mocks/init-theme/.cursor/commands/validate-section-group.md +88 -0
  90. package/ts-dist/mocks/init-theme/.cursor/commands/validate-theme-settings.md +119 -0
  91. package/ts-dist/mocks/init-theme/.cursor/examples/design-instructions-template.md +151 -0
  92. package/ts-dist/mocks/init-theme/.cursor/mcp.json +18 -0
  93. package/ts-dist/mocks/init-theme/.cursor/rules/README.md +160 -0
  94. package/ts-dist/mocks/init-theme/.cursor/rules/accessibility.mdc +24 -0
  95. package/ts-dist/mocks/init-theme/.cursor/rules/add-field.mdc +222 -0
  96. package/ts-dist/mocks/init-theme/.cursor/rules/add-theme-setting.mdc +39 -0
  97. package/ts-dist/mocks/init-theme/.cursor/rules/assemble-page.mdc +130 -0
  98. package/ts-dist/mocks/init-theme/.cursor/rules/audit-page.mdc +92 -0
  99. package/ts-dist/mocks/init-theme/.cursor/rules/build-section.mdc +178 -0
  100. package/ts-dist/mocks/init-theme/.cursor/rules/build-theme.mdc +47 -0
  101. package/ts-dist/mocks/init-theme/.cursor/rules/compare-section.mdc +94 -0
  102. package/ts-dist/mocks/init-theme/.cursor/rules/create-theme.mdc +78 -0
  103. package/ts-dist/mocks/init-theme/.cursor/rules/css.mdc +137 -0
  104. package/ts-dist/mocks/init-theme/.cursor/rules/design-spec-extraction.mdc +255 -0
  105. package/ts-dist/mocks/init-theme/.cursor/rules/extract-tokens.mdc +43 -0
  106. package/ts-dist/mocks/init-theme/.cursor/rules/figma-mcp-resolution.mdc +40 -0
  107. package/ts-dist/mocks/init-theme/.cursor/rules/fix-section.mdc +154 -0
  108. package/ts-dist/mocks/init-theme/.cursor/rules/general.mdc +30 -0
  109. package/ts-dist/mocks/init-theme/.cursor/rules/i18n.mdc +85 -0
  110. package/ts-dist/mocks/init-theme/.cursor/rules/javascript.mdc +85 -0
  111. package/ts-dist/mocks/init-theme/.cursor/rules/liquid-no-hardcoded-strings.mdc +42 -0
  112. package/ts-dist/mocks/init-theme/.cursor/rules/liquid.mdc +171 -0
  113. package/ts-dist/mocks/init-theme/.cursor/rules/mobile-desktop-setting-meta.mdc +34 -0
  114. package/ts-dist/mocks/init-theme/.cursor/rules/naming-convention.mdc +64 -0
  115. package/ts-dist/mocks/init-theme/.cursor/rules/pages.mdc +120 -0
  116. package/ts-dist/mocks/init-theme/.cursor/rules/performance.mdc +51 -0
  117. package/ts-dist/mocks/init-theme/.cursor/rules/qa-section.mdc +134 -0
  118. package/ts-dist/mocks/init-theme/.cursor/rules/redesign-section.mdc +147 -0
  119. package/ts-dist/mocks/init-theme/.cursor/rules/schema-sync.mdc +110 -0
  120. package/ts-dist/mocks/init-theme/.cursor/rules/schema.mdc +360 -0
  121. package/ts-dist/mocks/init-theme/.cursor/rules/share-urls.mdc +68 -0
  122. package/ts-dist/mocks/init-theme/.cursor/skills/browser-verify.md +128 -0
  123. package/ts-dist/mocks/init-theme/.cursor/skills/design-tokens.md +105 -0
  124. package/ts-dist/mocks/init-theme/.cursor/skills/page-json-contract.md +87 -0
  125. package/ts-dist/mocks/init-theme/.cursor/skills/qa-accessibility.md +35 -0
  126. package/ts-dist/mocks/init-theme/.cursor/skills/reference-lookup.md +88 -0
  127. package/ts-dist/mocks/init-theme/.cursor/skills/section-anatomy.md +173 -0
@@ -0,0 +1,156 @@
1
+ ---
2
+ title: "Pages"
3
+ weight: 7
4
+ ---
5
+
6
+ # Pages
7
+
8
+ Pages define the default section configurations for different page types. They are JSON files in the `pages/` folder that specify which sections appear and in what order.
9
+
10
+ ## Important Note
11
+
12
+ Zoho Commerce themes use a **single `page.liquid`** template file in the `sections/` folder for all custom pages created in the admin panel. There is no support for individual `pages/*.json` files for custom pages — the JSON files in the `pages/` folder only define default configurations for the built-in page types listed below.
13
+
14
+ ## Supported Page Types
15
+
16
+ | File | Page Type | Description |
17
+ |------|-----------|-------------|
18
+ | `index.json` | Home | Store homepage |
19
+ | `product.json` | Product | Product detail page |
20
+ | `collection.json` | Collection | Collection listing page |
21
+ | `category.json` | Category | Category listing page |
22
+ | `cart.json` | Cart | Shopping cart |
23
+ | `checkout.json` | Checkout | Checkout page |
24
+ | `search.json` | Search | Search results page |
25
+ | `blog.json` | Blog | Blog post page |
26
+ | `blogs.json` | Blogs | Blog listing page |
27
+ | `signin.json` | Sign In | Login page |
28
+ | `signup.json` | Sign Up | Registration page |
29
+ | `forgotpassword.json` | Password Reset | Password recovery page |
30
+ | `account-profile.json` | Account Profile | Customer profile page |
31
+ | `account-address.json` | Account Addresses | Saved addresses management |
32
+ | `account-order.json` | Account Orders | Order history listing |
33
+ | `account-order-detail.json` | Order Detail | Single order detail view |
34
+ | `account-order-status.json` | Order Status | Order tracking/status page |
35
+ | `account-quote-list.json` | Quote List | Customer quote request history |
36
+ | `account-quote-details.json` | Quote Details | Single quote detail view |
37
+ | `account-quote-request.json` | Quote Request | Submit a new quote request |
38
+ | `account-wishlist.json` | Wishlist | Customer wishlist page |
39
+ | `orders.json` | Orders | Orders overview page |
40
+ | `payment.json` | Payment | Payment confirmation/failure page |
41
+ | `sitemap.json` | Sitemap | XML sitemap page |
42
+ | `page.json` | Custom Pages | Default for all admin-created custom pages |
43
+ | `404.json` | Not Found | 404 error page |
44
+
45
+ ## Page Structure
46
+
47
+ Each page JSON file declares which sections appear and their default settings:
48
+
49
+ ```json
50
+ {
51
+ "sections": {
52
+ "hero": {
53
+ "type": "hero-banner",
54
+ "settings": {
55
+ "title": "Welcome to Our Store"
56
+ }
57
+ },
58
+ "featured": {
59
+ "type": "featured-products"
60
+ }
61
+ },
62
+ "order": ["hero", "featured"]
63
+ }
64
+ ```
65
+
66
+ ### Properties
67
+
68
+ | Property | Type | Description |
69
+ |----------|------|-------------|
70
+ | `layout` | string | Layout to use: `"theme"` or `"accounts"`. Omit to use the default `theme.liquid`. |
71
+ | `sections` | object | Map of section instances keyed by unique IDs |
72
+ | `order` | array | Array of section IDs defining render order |
73
+
74
+ Each entry in `sections` must reference a `type` matching a file in the `sections/` folder (without `.liquid`).
75
+
76
+ ---
77
+
78
+ ## Section Instance
79
+
80
+ ```json
81
+ {
82
+ "hero": {
83
+ "type": "hero-banner",
84
+ "settings": {
85
+ "title": "Summer Sale",
86
+ "background_color": "#f5f5f5"
87
+ },
88
+ "blocks": {
89
+ "slide_1": {
90
+ "type": "slide",
91
+ "settings": {
92
+ "image": {
93
+ "url": "summer-banner.webp",
94
+ "enable_customisation": true
95
+ },
96
+ "caption": "Up to 50% off"
97
+ }
98
+ }
99
+ },
100
+ "block_order": ["slide_1"]
101
+ }
102
+ }
103
+ ```
104
+
105
+ ### Section Instance Properties
106
+
107
+ | Property | Type | Description |
108
+ |----------|------|-------------|
109
+ | `type` | string | Section filename (without `.liquid`) |
110
+ | `settings` | object | Values matching the section's schema settings |
111
+ | `blocks` | object | Block instances keyed by unique IDs |
112
+ | `block_order` | array | Array of block IDs defining render order |
113
+
114
+ ---
115
+
116
+ ## Account Pages
117
+
118
+ Account pages (`account-profile.json`, `account-address.json`, `account-order.json`, `account-order-detail.json`, `account-order-status.json`, `account-quote-list.json`, `account-quote-details.json`, `account-quote-request.json`) use `"layout": "accounts"` to load the `accounts.liquid` layout instead of the default `theme.liquid`. This layout is purpose-built for the account area — it renders the `accounts-header` snippet and loads the account-specific scripts required for the Zoho accounts portal.
119
+
120
+ All account pages share the same structure: an `account-tab-navigation` section (the sidebar/tab nav between Profile, Orders, Addresses, and Quotes) paired with their respective content section:
121
+
122
+ ```json
123
+ {
124
+ "layout": "accounts",
125
+ "sections": {
126
+ "account-tab": {
127
+ "type": "account-tab-navigation"
128
+ },
129
+ "profile": {
130
+ "type": "account-profile"
131
+ }
132
+ },
133
+ "order": ["account-tab", "profile"]
134
+ }
135
+ ```
136
+
137
+ | Page file | Section type used |
138
+ |-----------|------------------|
139
+ | `account-profile.json` | `account-profile` |
140
+ | `account-address.json` | `account-address` |
141
+ | `account-order.json` | `account-order` |
142
+ | `account-order-detail.json` | `accounts-order-details` |
143
+ | `account-order-status.json` | `account-order-status` |
144
+ | `account-quote-list.json` | `account-quote-list` |
145
+ | `account-quote-details.json` | `accounts-quote-details` |
146
+ | `account-quote-request.json` | `account-quote-request` |
147
+
148
+ The `account-wishlist.json` and `orders.json` pages use `"layout": "theme"` (the regular layout with header and footer), not the accounts layout.
149
+
150
+ ---
151
+
152
+ ## Custom Pages
153
+
154
+ All custom pages created through the Zoho Commerce admin panel use the single `page.liquid` section template. The `page.json` file defines the default configuration for these pages.
155
+
156
+ To create custom page layouts, use section settings and blocks within `page.liquid` to allow store admins to customize the content through the theme editor.
@@ -0,0 +1,419 @@
1
+ ---
2
+ title: "Filters"
3
+ weight: 11
4
+ ---
5
+
6
+ # Filters
7
+
8
+ Filters modify the output of variables. Apply them using the pipe `|` character.
9
+
10
+ ```liquid
11
+ {{ product.title | upcase }}
12
+ {{ "main.css" | asset_url }}
13
+ ```
14
+
15
+ Multiple filters can be chained — they execute left to right.
16
+
17
+ ---
18
+
19
+ ## Zoho Commerce Filters
20
+
21
+ These filters are specific to Zoho Commerce and extend standard Liquid.
22
+
23
+ ### asset_url
24
+
25
+ Prepends the CDN URL to asset filenames from the `assets/` folder. Uses `fingerprint.json` for cache busting with versioned filenames.
26
+
27
+ ```liquid
28
+ {{ "main.css" | asset_url }}
29
+ ```
30
+
31
+ **Output:** `https://cdn.example.com/assets/main-585919664682927.css`
32
+
33
+ ```liquid
34
+ <link rel="stylesheet" href="{{ "main.css" | asset_url }}">
35
+ <script src="{{ "header.js" | asset_url }}" defer></script>
36
+ <img src="{{ "logo.png" | asset_url }}" alt="Logo">
37
+ ```
38
+
39
+ **Output:**
40
+ ```html
41
+ <link rel="stylesheet" href="https://cdn.example.com/assets/main-585919664682927.css">
42
+ <script src="https://cdn.example.com/assets/header-317103717237078.js" defer></script>
43
+ <img src="https://cdn.example.com/assets/logo-442891003756812.png" alt="Logo">
44
+ ```
45
+
46
+ > **Important:** Use `asset_url` only for files in your theme's `assets/` folder. Pass just the filename (e.g., `"main.css"`), not the full path. The filter looks up the fingerprinted filename and prepends the CDN URL.
47
+
48
+ ### image_url
49
+
50
+ Returns the URL for an image with optional dimension parameters. Used primarily for product images and other dynamic content.
51
+
52
+ ```liquid
53
+ {{ product.cover_media | image_url }}
54
+ ```
55
+
56
+ **Output:** `https://cdn.example.com/products/product-image.jpg`
57
+
58
+ ```liquid
59
+ {{ product.cover_media | image_url: width: 300, height: 200 }}
60
+ ```
61
+
62
+ **Output:** `https://cdn.example.com/products/product-image.jpg?width=300&height=200`
63
+
64
+ > **Common Error:** Don't confuse `image_url` with `asset_url`. Use `image_url` for product/collection images from the Zoho Commerce system. Use `asset_url` for static theme assets.
65
+
66
+ ### color_component
67
+
68
+ Extracts a color channel value from a hex color string.
69
+
70
+ ```liquid
71
+ {{ "#ff5733" | color_component: "red" }}
72
+ {{ "#ff5733" | color_component: "green" }}
73
+ {{ "#ff5733" | color_component: "blue" }}
74
+ ```
75
+
76
+ **Output:**
77
+ - `255`
78
+ - `87`
79
+ - `51`
80
+
81
+ **Supported components:** `red`, `green`, `blue`, `hue`, `saturation`, `lightness`, `alpha`
82
+
83
+ ### t (translate)
84
+
85
+ Translates a key using the current locale's i18n file.
86
+
87
+ ```liquid
88
+ {{ "product.add_to_cart" | t }}
89
+ {{ "header.cart" | t }}
90
+ ```
91
+
92
+ **Output:**
93
+ - `Add to Cart`
94
+ - `Cart`
95
+
96
+ (Values from `i18n/en..json`)
97
+
98
+ ### json
99
+
100
+ Converts a value to JSON format. Useful for passing data to JavaScript.
101
+
102
+ ```liquid
103
+ <script>
104
+ var productData = {{ product | json }};
105
+ </script>
106
+ ```
107
+
108
+ **Output:**
109
+ ```html
110
+ <script>
111
+ var productData = {"id":123,"title":"Blue T-Shirt","price":2999,...};
112
+ </script>
113
+ ```
114
+
115
+ ### default
116
+
117
+ Returns a fallback value if the input is nil, empty, or false.
118
+
119
+ ```liquid
120
+ {{ product.description | default: "No description available" }}
121
+ {{ customer.name | default: "Guest" }}
122
+ ```
123
+
124
+ **Output:**
125
+ - `No description available` (if description is empty)
126
+ - `Guest` (if customer name is not set)
127
+
128
+ ---
129
+
130
+ ## String Filters
131
+
132
+ ### append
133
+
134
+ Appends a string to the end of another string.
135
+
136
+ ```liquid
137
+ {{ "hello" | append: " world" }}
138
+ ```
139
+
140
+ **Output:** `hello world`
141
+
142
+ ### capitalize
143
+
144
+ Capitalizes the first character.
145
+
146
+ ```liquid
147
+ {{ "hello" | capitalize }}
148
+ ```
149
+
150
+ **Output:** `Hello`
151
+
152
+ ### downcase / upcase
153
+
154
+ Converts to lowercase or uppercase.
155
+
156
+ ```liquid
157
+ {{ "Hello" | downcase }}
158
+ {{ "hello" | upcase }}
159
+ ```
160
+
161
+ **Output:**
162
+ - `hello`
163
+ - `HELLO`
164
+
165
+ ### strip / lstrip / rstrip
166
+
167
+ Removes whitespace — all, leading only, or trailing only.
168
+
169
+ ```liquid
170
+ {{ " hello world " | strip }}
171
+ {{ " hello" | lstrip }}
172
+ {{ "hello " | rstrip }}
173
+ ```
174
+
175
+ **Output:**
176
+ - `hello world`
177
+ - `hello`
178
+ - `hello`
179
+
180
+ ### strip_html
181
+
182
+ Strips all HTML tags from a string.
183
+
184
+ ```liquid
185
+ {{ "<b>bold</b> and <i>italic</i>" | strip_html }}
186
+ ```
187
+
188
+ **Output:** `bold and italic`
189
+
190
+ ### escape
191
+
192
+ Escapes HTML entities for safe rendering.
193
+
194
+ ```liquid
195
+ {{ "<p>Hello & welcome</p>" | escape }}
196
+ ```
197
+
198
+ **Output:** `&lt;p&gt;Hello &amp; welcome&lt;/p&gt;`
199
+
200
+ ### url_encode / url_decode
201
+
202
+ Encodes or decodes a string for use in URLs.
203
+
204
+ ```liquid
205
+ {{ "hello world" | url_encode }}
206
+ {{ "hello+world" | url_decode }}
207
+ ```
208
+
209
+ **Output:**
210
+ - `hello+world`
211
+ - `hello world`
212
+
213
+ ### truncate / truncatewords
214
+
215
+ Truncates to a character count or word count.
216
+
217
+ ```liquid
218
+ {{ "Hello wonderful world" | truncate: 8 }}
219
+ {{ "one two three four five" | truncatewords: 2 }}
220
+ ```
221
+
222
+ **Output:**
223
+ - `Hello...`
224
+ - `one two...`
225
+
226
+ ### replace / replace_first
227
+
228
+ Replaces all or the first occurrence of a substring.
229
+
230
+ ```liquid
231
+ {{ "Hello Hello" | replace: "Hello", "Hi" }}
232
+ {{ "aabb" | replace_first: "a", "x" }}
233
+ ```
234
+
235
+ **Output:**
236
+ - `Hi Hi`
237
+ - `xabb`
238
+
239
+ ### remove / remove_first
240
+
241
+ Removes all or the first occurrence of a substring.
242
+
243
+ ```liquid
244
+ {{ "Hello World" | remove: "l" }}
245
+ {{ "Hello World" | remove_first: "l" }}
246
+ ```
247
+
248
+ **Output:**
249
+ - `Heo Word`
250
+ - `Helo World`
251
+
252
+ ### prepend
253
+
254
+ Prepends a string to the beginning.
255
+
256
+ ```liquid
257
+ {{ "world" | prepend: "hello " }}
258
+ ```
259
+
260
+ **Output:** `hello world`
261
+
262
+ ### newline_to_br
263
+
264
+ Replaces newline characters with `<br>` tags.
265
+
266
+ ```liquid
267
+ {% assign text = "Line 1
268
+ Line 2" %}
269
+ {{ text | newline_to_br }}
270
+ ```
271
+
272
+ **Output:** `Line 1<br>Line 2`
273
+
274
+ ### split
275
+
276
+ Splits a string into an array by a delimiter.
277
+
278
+ ```liquid
279
+ {% assign tags = "red,green,blue" | split: "," %}
280
+ {{ tags[0] }}
281
+ ```
282
+
283
+ **Output:** `red`
284
+
285
+ ### slice
286
+
287
+ Extracts a substring by offset and length.
288
+
289
+ ```liquid
290
+ {{ "hello world" | slice: 0, 5 }}
291
+ {{ "hello" | slice: 1, 3 }}
292
+ ```
293
+
294
+ **Output:**
295
+ - `hello`
296
+ - `ell`
297
+
298
+ ### strip_newlines
299
+
300
+ Removes all newline characters from a string.
301
+
302
+ ```liquid
303
+ {% assign text = "Line 1
304
+ Line 2" %}
305
+ {{ text | strip_newlines }}
306
+ ```
307
+
308
+ **Output:** `Line 1Line 2`
309
+
310
+ ---
311
+
312
+ ## Math Filters
313
+
314
+ | Filter | Example | Result | Description |
315
+ |--------|---------|--------|-------------|
316
+ | `plus` | `3 \| plus: 2` | `5` | Addition |
317
+ | `minus` | `5 \| minus: 2` | `3` | Subtraction |
318
+ | `times` | `3 \| times: 4` | `12` | Multiplication |
319
+ | `divided_by` | `10 \| divided_by: 3` | `3` | Integer division |
320
+ | `modulo` | `10 \| modulo: 3` | `1` | Remainder |
321
+ | `round` | `4.6 \| round` | `5` | Rounds to nearest integer |
322
+ | `ceil` | `4.1 \| ceil` | `5` | Rounds up |
323
+ | `floor` | `4.9 \| floor` | `4` | Rounds down |
324
+ | `abs` | `-5 \| abs` | `5` | Absolute value |
325
+ | `at_most` | `5 \| at_most: 3` | `3` | Limits to maximum |
326
+ | `at_least` | `2 \| at_least: 5` | `5` | Ensures minimum |
327
+
328
+ ---
329
+
330
+ ## Array Filters
331
+
332
+ ### map
333
+
334
+ Extracts a property from each item in an array.
335
+
336
+ ```liquid
337
+ {{ collection.products | map: "title" | join: ", " }}
338
+ ```
339
+
340
+ ### where
341
+
342
+ Filters array items by a property value.
343
+
344
+ ```liquid
345
+ {% assign available = collection.products | where: "available", true %}
346
+ {% for product in available %}
347
+ {{ product.title }}
348
+ {% endfor %}
349
+ ```
350
+
351
+ ### sort / sort_natural
352
+
353
+ Sorts alphabetically or case-insensitively.
354
+
355
+ ```liquid
356
+ {% assign sorted = collection.products | sort: "price" %}
357
+ ```
358
+
359
+ ### Other Array Filters
360
+
361
+ | Filter | Description |
362
+ |--------|-------------|
363
+ | `join` | Joins array into a string with separator |
364
+ | `first` | Returns first element |
365
+ | `last` | Returns last element |
366
+ | `size` | Returns element count |
367
+ | `reverse` | Reverses order |
368
+ | `uniq` | Removes duplicates |
369
+ | `compact` | Removes nil values |
370
+ | `concat` | Concatenates two arrays |
371
+
372
+ ---
373
+
374
+ ## Date Filter
375
+
376
+ The `date` filter formats timestamps.
377
+
378
+ ```liquid
379
+ {{ product.created_at | date: "%B %d, %Y" }}
380
+ ```
381
+
382
+ **Output:** `January 15, 2024`
383
+
384
+ ```liquid
385
+ {{ "now" | date: "%Y-%m-%d" }}
386
+ ```
387
+
388
+ **Output:** `2024-07-15`
389
+
390
+ ### Format Codes
391
+
392
+ | Code | Output | Example |
393
+ |------|--------|---------|
394
+ | `%Y` | 4-digit year | `2024` |
395
+ | `%m` | Month (01-12) | `07` |
396
+ | `%d` | Day (01-31) | `15` |
397
+ | `%B` | Full month name | `January` |
398
+ | `%b` | Abbreviated month | `Jan` |
399
+ | `%A` | Full weekday | `Monday` |
400
+ | `%a` | Abbreviated weekday | `Mon` |
401
+ | `%H` | Hour 24h (00-23) | `14` |
402
+ | `%I` | Hour 12h (01-12) | `02` |
403
+ | `%M` | Minute (00-59) | `30` |
404
+ | `%S` | Second (00-59) | `45` |
405
+ | `%p` | AM/PM | `PM` |
406
+
407
+ ---
408
+
409
+ ## Quick Reference
410
+
411
+ | Category | Filters |
412
+ |----------|---------|
413
+ | **Asset** | `asset_url`, `image_url` |
414
+ | **Color** | `color_component` |
415
+ | **Commerce** | `json`, `default`, `t` |
416
+ | **String** | `append`, `capitalize`, `downcase`, `upcase`, `strip`, `truncate`, `replace`, `remove`, `split`, `slice`, `escape`, `url_encode` |
417
+ | **Math** | `plus`, `minus`, `times`, `divided_by`, `modulo`, `round`, `ceil`, `floor`, `abs` |
418
+ | **Array** | `join`, `first`, `last`, `size`, `sort`, `reverse`, `map`, `where`, `uniq`, `compact` |
419
+ | **Date** | `date` |