@spree/docs 0.1.0 → 0.1.2
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.
- package/dist/api-reference/store-api/errors.md +2 -2
- package/dist/api-reference/store-api/idempotency.md +1 -1
- package/dist/api-reference/store-api/localization.md +4 -4
- package/dist/api-reference/store-api/metadata.md +2 -2
- package/dist/api-reference/store.yaml +10599 -0
- package/dist/api-reference/storefront/authentication.md +2 -2
- package/dist/api-reference/tutorials/adyen-integration-guide-for-android.md +2 -2
- package/dist/api-reference/tutorials/adyen-integration-guide-for-ios.md +2 -2
- package/dist/api-reference/tutorials/quick-checkout-with-stripe.md +8 -8
- package/dist/api-reference/v2/introduction.md +2 -2
- package/dist/api-reference/webhooks-events.md +2 -2
- package/dist/developer/admin/admin.md +18 -18
- package/dist/developer/admin/components.md +1 -1
- package/dist/developer/admin/extending-ui.md +26 -26
- package/dist/developer/admin/helper-methods.md +2 -2
- package/dist/developer/admin/navigation.md +5 -5
- package/dist/developer/admin/tables.md +4 -4
- package/dist/developer/cli/quickstart.md +2 -2
- package/dist/developer/contributing/creating-an-extension.md +12 -12
- package/dist/developer/contributing/quickstart.md +1 -1
- package/dist/developer/core-concepts/addresses.md +11 -11
- package/dist/developer/core-concepts/adjustments.md +8 -8
- package/dist/developer/core-concepts/architecture.md +21 -21
- package/dist/developer/core-concepts/calculators.md +4 -4
- package/dist/developer/core-concepts/customers.md +9 -9
- package/dist/developer/core-concepts/events.md +5 -5
- package/dist/developer/core-concepts/inventory.md +5 -5
- package/dist/developer/core-concepts/markets.md +10 -10
- package/dist/developer/core-concepts/media.md +3 -3
- package/dist/developer/core-concepts/metafields.md +6 -6
- package/dist/developer/core-concepts/orders.md +14 -14
- package/dist/developer/core-concepts/payments.md +9 -9
- package/dist/developer/core-concepts/pricing.md +10 -10
- package/dist/developer/core-concepts/products.md +10 -10
- package/dist/developer/core-concepts/promotions.md +5 -5
- package/dist/developer/core-concepts/reports.md +2 -2
- package/dist/developer/core-concepts/search-filtering.md +7 -7
- package/dist/developer/core-concepts/shipments.md +13 -13
- package/dist/developer/core-concepts/slugs.md +3 -3
- package/dist/developer/core-concepts/staff-roles.md +7 -7
- package/dist/developer/core-concepts/store-credits-gift-cards.md +4 -4
- package/dist/developer/core-concepts/stores.md +15 -15
- package/dist/developer/core-concepts/taxes.md +11 -11
- package/dist/developer/core-concepts/translations.md +6 -6
- package/dist/developer/core-concepts/users.md +12 -12
- package/dist/developer/core-concepts/webhooks.md +8 -8
- package/dist/developer/create-spree-app/quickstart.md +5 -5
- package/dist/developer/customization/api.md +2 -2
- package/dist/developer/customization/authentication.md +2 -2
- package/dist/developer/customization/checkout.md +7 -7
- package/dist/developer/customization/decorators.md +24 -24
- package/dist/developer/customization/dependencies.md +1 -1
- package/dist/developer/customization/metadata.md +3 -3
- package/dist/developer/customization/permissions.md +1 -1
- package/dist/developer/customization/quickstart.md +9 -9
- package/dist/developer/customization/v4/checkout.md +3 -3
- package/dist/developer/customization/v4/deface.md +1 -1
- package/dist/developer/deployment/assets.md +1 -1
- package/dist/developer/deployment/aws.md +5 -5
- package/dist/developer/deployment/docker.md +2 -2
- package/dist/developer/deployment/environment_variables.md +1 -1
- package/dist/developer/deployment/render.md +5 -5
- package/dist/developer/getting-started/quickstart.md +2 -2
- package/dist/developer/how-to/custom-payment-method.md +6 -6
- package/dist/developer/how-to/custom-promotion.md +7 -7
- package/dist/developer/how-to/custom-report.md +3 -3
- package/dist/developer/how-to/custom-search-provider.md +7 -7
- package/dist/developer/multi-store/quickstart.md +1 -1
- package/dist/developer/multi-tenant/quickstart.md +1 -1
- package/dist/developer/sdk/authentication.md +1 -1
- package/dist/developer/sdk/configuration.md +1 -1
- package/dist/developer/sdk/store/markets.md +3 -3
- package/dist/developer/storefront/nextjs/customization.md +1 -1
- package/dist/developer/storefront/nextjs/quickstart.md +2 -2
- package/dist/developer/tutorial/admin.md +2 -2
- package/dist/developer/tutorial/extending-models.md +15 -15
- package/dist/developer/tutorial/file-uploads.md +1 -1
- package/dist/developer/tutorial/introduction.md +7 -7
- package/dist/developer/tutorial/rich-text.md +1 -1
- package/dist/developer/tutorial/testing.md +5 -61
- package/dist/developer/upgrades/3.7-to-4.0.md +1 -1
- package/dist/developer/upgrades/4.0-to-4.1.md +1 -1
- package/dist/developer/upgrades/4.10-to-5.0.md +1 -1
- package/dist/developer/upgrades/4.5-to-4.6.md +4 -4
- package/dist/developer/upgrades/4.8-to-4.9.md +1 -1
- package/dist/developer/upgrades/4.9-to-4.10.md +1 -1
- package/dist/developer/upgrades/5.0-to-5.1.md +1 -1
- package/dist/developer/upgrades/5.1-to-5.2.md +2 -2
- package/dist/developer/upgrades/5.2-to-5.3.md +2 -2
- package/dist/developer/upgrades/5.3-to-5.4.md +5 -5
- package/dist/developer/upgrades/quickstart.md +1 -1
- package/dist/integrations/integrations.md +10 -10
- package/dist/integrations/payments/adyen.md +1 -1
- package/dist/integrations/search/meilisearch.md +2 -2
- package/package.json +7 -2
- package/dist/developer/storefront/blocks.md +0 -285
- package/dist/developer/storefront/custom-css.md +0 -260
- package/dist/developer/storefront/custom-javascript.md +0 -166
- package/dist/developer/storefront/helper-methods.md +0 -1288
- package/dist/developer/storefront/links.md +0 -298
- package/dist/developer/storefront/pages.md +0 -163
- package/dist/developer/storefront/sections.md +0 -569
- package/dist/developer/storefront/storefront.md +0 -56
- package/dist/developer/storefront/themes.md +0 -161
- package/dist/developer/tutorial/page-builder.md +0 -487
- package/dist/developer/tutorial/seo.md +0 -332
- package/dist/developer/tutorial/storefront.md +0 -352
|
@@ -1,1288 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
title: Storefront Helper Methods
|
|
3
|
-
sidebarTitle: Helper Methods
|
|
4
|
-
---
|
|
5
|
-
|
|
6
|
-
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.
|
|
7
|
-
|
|
8
|
-
## Context Helpers
|
|
9
|
-
|
|
10
|
-
### `current_store`
|
|
11
|
-
|
|
12
|
-
<details>
|
|
13
|
-
<summary>Properties</summary>
|
|
14
|
-
|
|
15
|
-
- **`name`** (`string`) — Store name
|
|
16
|
-
Example: "My Store"
|
|
17
|
-
|
|
18
|
-
- **`url`** (`string`) — Store URL
|
|
19
|
-
Example: `https://mystore.com`
|
|
20
|
-
|
|
21
|
-
- **`code`** (`string`) — Unique store identifier
|
|
22
|
-
Example: `my-store`
|
|
23
|
-
|
|
24
|
-
- **`mail_from_address`** (`string`) — Email address used for sending emails
|
|
25
|
-
Example: `store@example.com`
|
|
26
|
-
|
|
27
|
-
- **`default_currency`** (`string`) — Default store currency
|
|
28
|
-
Example: `USD`
|
|
29
|
-
|
|
30
|
-
- **`supported_currencies`** (`string`) — List of supported currencies
|
|
31
|
-
Example: `USD,EUR,GBP`
|
|
32
|
-
|
|
33
|
-
- **`default_locale`** (`string`) — Default store locale
|
|
34
|
-
Example: `en`
|
|
35
|
-
|
|
36
|
-
- **`supported_locales`** (`string`) — List of supported locales
|
|
37
|
-
Example: `en,es,fr`
|
|
38
|
-
|
|
39
|
-
- **`default_country_id`** (`integer`) — Default country ID
|
|
40
|
-
Example: `1`
|
|
41
|
-
|
|
42
|
-
- **`default_country`** (`Spree::Country`) — Default country
|
|
43
|
-
<details>
|
|
44
|
-
<summary>properties</summary>
|
|
45
|
-
|
|
46
|
-
- **`id`** (`integer`) — Country ID
|
|
47
|
-
Example: 1
|
|
48
|
-
|
|
49
|
-
- **`name`** (`string`) — Country name
|
|
50
|
-
Example: `United States`
|
|
51
|
-
|
|
52
|
-
- **`iso3`** (`string`) — Country ISO3 code
|
|
53
|
-
Example: `USA`
|
|
54
|
-
|
|
55
|
-
- **`iso`** (`string`) — Country ISO code
|
|
56
|
-
Example: `US`
|
|
57
|
-
|
|
58
|
-
- **`iso_name`** (`string`) — Country ISO name
|
|
59
|
-
Example: `UNITED STATES`
|
|
60
|
-
|
|
61
|
-
- **`states_required`** (`boolean`) — Whether states are required for this country
|
|
62
|
-
Example: `true`
|
|
63
|
-
|
|
64
|
-
- **`zipcode_required`** (`boolean`) — Whether zipcodes are required for this country
|
|
65
|
-
Example: `true`
|
|
66
|
-
|
|
67
|
-
</details>
|
|
68
|
-
|
|
69
|
-
- **`checkout_zone_id`** (`integer`) — Checkout zone ID
|
|
70
|
-
Example: `2`
|
|
71
|
-
|
|
72
|
-
- **`seo_title`** (`string`) — SEO title
|
|
73
|
-
Example: `My Amazing Store`
|
|
74
|
-
|
|
75
|
-
- **`meta_description`** (`string`) — Meta description for SEO
|
|
76
|
-
Example: `The best products at the best prices`
|
|
77
|
-
|
|
78
|
-
</details>
|
|
79
|
-
|
|
80
|
-
Returns the current store [Spree::Store](https://github.com/spree/spree/blob/master/core/app/models/spree/store.rb) instance.
|
|
81
|
-
|
|
82
|
-
### `current_theme`
|
|
83
|
-
|
|
84
|
-
<details>
|
|
85
|
-
<summary>properties</summary>
|
|
86
|
-
|
|
87
|
-
- **`id`** (`integer`) — Theme ID
|
|
88
|
-
Example: 1
|
|
89
|
-
|
|
90
|
-
- **`name`** (`string`) — Theme name
|
|
91
|
-
Example: `Winter Sale Theme`
|
|
92
|
-
|
|
93
|
-
- **`preferred_checkout_sidebar_text_color`** (`string`) — Checkout sidebar text color
|
|
94
|
-
Example: `#000000`
|
|
95
|
-
|
|
96
|
-
- **`preferred_custom_font_code`** (`string`) — Custom font code
|
|
97
|
-
Example: `@import url('https://fonts.googleapis.com/css2?family=Inter&display=swap');`
|
|
98
|
-
|
|
99
|
-
- **`preferred_font_family`** (`string`) — Font family
|
|
100
|
-
Example: `Inter`
|
|
101
|
-
|
|
102
|
-
- **`preferred_font_size_scale`** (`integer`) — Font size scale
|
|
103
|
-
Example: `100`
|
|
104
|
-
|
|
105
|
-
- **`preferred_header_font_family`** (`string`) — Header font family
|
|
106
|
-
Example: `Inter`
|
|
107
|
-
|
|
108
|
-
- **`preferred_header_font_size_scale`** (`integer`) — Header font size scale
|
|
109
|
-
Example: `100`
|
|
110
|
-
|
|
111
|
-
- **`preferred_headings_uppercase`** (`boolean`) — Headings uppercase
|
|
112
|
-
Example: `true`
|
|
113
|
-
|
|
114
|
-
- **`preferred_button_border_thickness`** (`integer`) — Button border thickness
|
|
115
|
-
Example: `1`
|
|
116
|
-
|
|
117
|
-
- **`preferred_button_border_opacity`** (`integer`) — Button border opacity
|
|
118
|
-
Example: `100`
|
|
119
|
-
|
|
120
|
-
- **`preferred_button_border_radius`** (`integer`) — Button border radius
|
|
121
|
-
Example: `100`
|
|
122
|
-
|
|
123
|
-
- **`preferred_button_shadow_opacity`** (`integer`) — Button shadow opacity
|
|
124
|
-
Example: `0`
|
|
125
|
-
|
|
126
|
-
- **`preferred_button_shadow_horizontal_offset`** (`integer`) — Button shadow horizontal offset
|
|
127
|
-
Example: `0`
|
|
128
|
-
|
|
129
|
-
- **`preferred_button_shadow_vertical_offset`** (`integer`) — Button shadow vertical offset
|
|
130
|
-
Example: `4`
|
|
131
|
-
|
|
132
|
-
- **`preferred_button_shadow_blur`** (`integer`) — Button shadow blur
|
|
133
|
-
Example: `5`
|
|
134
|
-
|
|
135
|
-
- **`preferred_input_border_thickness`** (`integer`) — Input border thickness
|
|
136
|
-
Example: `1`
|
|
137
|
-
|
|
138
|
-
- **`preferred_input_border_opacity`** (`integer`) — Input border opacity
|
|
139
|
-
Example: `100`
|
|
140
|
-
|
|
141
|
-
- **`preferred_input_border_radius`** (`integer`) — Input border radius
|
|
142
|
-
Example: `8`
|
|
143
|
-
|
|
144
|
-
- **`preferred_input_shadow_opacity`** (`integer`) — Input shadow opacity
|
|
145
|
-
Example: `0`
|
|
146
|
-
|
|
147
|
-
- **`preferred_input_shadow_horizontal_offset`** (`integer`) — Input shadow horizontal offset
|
|
148
|
-
Example: `0`
|
|
149
|
-
|
|
150
|
-
- **`preferred_input_shadow_vertical_offset`** (`integer`) — Input shadow vertical offset
|
|
151
|
-
Example: `4`
|
|
152
|
-
|
|
153
|
-
- **`preferred_input_shadow_blur`** (`integer`) — Input shadow blur
|
|
154
|
-
Example: `5`
|
|
155
|
-
|
|
156
|
-
- **`preferred_border_width`** (`integer`) — Border width
|
|
157
|
-
Example: `1`
|
|
158
|
-
|
|
159
|
-
- **`preferred_border_radius`** (`integer`) — Border radius
|
|
160
|
-
Example: `6`
|
|
161
|
-
|
|
162
|
-
- **`preferred_border_shadow_opacity`** (`integer`) — Border shadow opacity
|
|
163
|
-
Example: `0`
|
|
164
|
-
|
|
165
|
-
- **`preferred_border_shadow_horizontal_offset`** (`integer`) — Border shadow horizontal offset
|
|
166
|
-
Example: `0`
|
|
167
|
-
|
|
168
|
-
- **`preferred_border_shadow_vertical_offset`** (`integer`) — Border shadow vertical offset
|
|
169
|
-
Example: `4`
|
|
170
|
-
|
|
171
|
-
- **`preferred_border_shadow_blur`** (`integer`) — Border shadow blur
|
|
172
|
-
Example: `5`
|
|
173
|
-
|
|
174
|
-
- **`preferred_product_listing_image_height`** (`integer`) — Product listing image height
|
|
175
|
-
Example: `300`
|
|
176
|
-
|
|
177
|
-
- **`preferred_product_listing_image_width`** (`integer`) — Product listing image width
|
|
178
|
-
Example: `300`
|
|
179
|
-
|
|
180
|
-
- **`preferred_product_listing_image_height_mobile`** (`integer`) — Product listing image height mobile
|
|
181
|
-
Example: `190`
|
|
182
|
-
|
|
183
|
-
- **`preferred_product_listing_image_width_mobile`** (`integer`) — Product listing image width mobile
|
|
184
|
-
Example: `190`
|
|
185
|
-
|
|
186
|
-
- **`preferred_primary_color`** (`string`) — Primary color
|
|
187
|
-
Example: `#000000`
|
|
188
|
-
|
|
189
|
-
- **`preferred_accent_color`** (`string`) — Accent color
|
|
190
|
-
Example: `#F0EFE9`
|
|
191
|
-
|
|
192
|
-
- **`preferred_danger_color`** (`string`) — Danger color
|
|
193
|
-
Example: `#C73528`
|
|
194
|
-
|
|
195
|
-
- **`preferred_neutral_color`** (`string`) — Neutral color
|
|
196
|
-
Example: `#999999`
|
|
197
|
-
|
|
198
|
-
- **`preferred_background_color`** (`string`) — Background color
|
|
199
|
-
Example: `#FFFFFF`
|
|
200
|
-
|
|
201
|
-
- **`preferred_text_color`** (`string`) — Text color
|
|
202
|
-
Example: `#000000`
|
|
203
|
-
|
|
204
|
-
- **`preferred_success_color`** (`string`) — Success color
|
|
205
|
-
Example: `#00C773`
|
|
206
|
-
|
|
207
|
-
- **`preferred_button_background_color`** (`string`) — Button background color
|
|
208
|
-
Example: `#000000`
|
|
209
|
-
|
|
210
|
-
- **`preferred_button_text_color`** (`string`) — Button text color
|
|
211
|
-
Example: `#ffffff`
|
|
212
|
-
|
|
213
|
-
- **`preferred_button_hover_background_color`** (`string`) — Button hover background color
|
|
214
|
-
Example: `#000000`
|
|
215
|
-
|
|
216
|
-
- **`preferred_button_hover_text_color`** (`string`) — Button hover text color
|
|
217
|
-
Example: `#ffffff`
|
|
218
|
-
|
|
219
|
-
- **`preferred_button_border_color`** (`string`) — Button border color
|
|
220
|
-
Example: `#000000`
|
|
221
|
-
|
|
222
|
-
- **`preferred_border_color`** (`string`) — Border color
|
|
223
|
-
Example: `#E9E7DC`
|
|
224
|
-
|
|
225
|
-
- **`preferred_sidebar_border_color`** (`string`) — Sidebar border color
|
|
226
|
-
Example: `#E9E7DC`
|
|
227
|
-
|
|
228
|
-
- **`preferred_secondary_button_background_color`** (`string`) — Secondary button background color
|
|
229
|
-
Example: `#000000`
|
|
230
|
-
|
|
231
|
-
- **`preferred_secondary_button_text_color`** (`string`) — Secondary button text color
|
|
232
|
-
Example: `#ffffff`
|
|
233
|
-
|
|
234
|
-
- **`preferred_secondary_button_hover_background_color`** (`string`) — Secondary button hover background color
|
|
235
|
-
Example: `#000000`
|
|
236
|
-
|
|
237
|
-
- **`preferred_secondary_button_hover_text_color`** (`string`) — Secondary button hover text color
|
|
238
|
-
Example: `#ffffff`
|
|
239
|
-
|
|
240
|
-
- **`preferred_input_text_color`** (`string`) — Input text color
|
|
241
|
-
Example: `#6b7280`
|
|
242
|
-
|
|
243
|
-
- **`preferred_input_background_color`** (`string`) — Input background color
|
|
244
|
-
Example: `#ffffff`
|
|
245
|
-
|
|
246
|
-
- **`preferred_input_border_color`** (`string`) — Input border color
|
|
247
|
-
Example: `#000000`
|
|
248
|
-
|
|
249
|
-
- **`preferred_input_focus_border_color`** (`string`) — Input focus border color
|
|
250
|
-
Example: `#000000`
|
|
251
|
-
|
|
252
|
-
- **`preferred_input_focus_background_color`** (`string`) — Input focus background color
|
|
253
|
-
Example: `#ffffff`
|
|
254
|
-
|
|
255
|
-
- **`preferred_input_focus_text_color`** (`string`) — Input focus text color
|
|
256
|
-
Example: `#000000`
|
|
257
|
-
|
|
258
|
-
- **`preferred_checkout_sidebar_background_color`** (`string`) — Checkout sidebar background color
|
|
259
|
-
Example: `#f3f4f6`
|
|
260
|
-
|
|
261
|
-
- **`preferred_checkout_divider_background_color`** (`string`) — Checkout divider background color
|
|
262
|
-
Example: `#f3f4f6`
|
|
263
|
-
|
|
264
|
-
- **`preferred_checkout_sidebar_text_color`** (`string`) — Checkout sidebar text color
|
|
265
|
-
Example: `#000000`
|
|
266
|
-
|
|
267
|
-
</details>
|
|
268
|
-
|
|
269
|
-
Returns the current theme [Spree::Theme](https://github.com/spree/spree/blob/master/core/app/models/spree/theme.rb) instance.
|
|
270
|
-
|
|
271
|
-
### `current_page`
|
|
272
|
-
|
|
273
|
-
Returns the current [Spree::Page](https://github.com/spree/spree/blob/main/core/app/models/spree/page.rb) instance for the current route.
|
|
274
|
-
|
|
275
|
-
```erb
|
|
276
|
-
<%= current_page.name %>
|
|
277
|
-
```
|
|
278
|
-
|
|
279
|
-
### `current_order`
|
|
280
|
-
|
|
281
|
-
<details>
|
|
282
|
-
<summary>properties</summary>
|
|
283
|
-
|
|
284
|
-
- **`number`** (`string`) — The order number
|
|
285
|
-
Example: `R123456789`
|
|
286
|
-
|
|
287
|
-
- **`total`** (`decimal`) — The total amount of the order
|
|
288
|
-
Example: 99.99
|
|
289
|
-
|
|
290
|
-
- **`display_total`** (`string`) — Formatted total with currency
|
|
291
|
-
Example: "$99.99"
|
|
292
|
-
|
|
293
|
-
- **`item_total`** (`decimal`) — Sum of all line item amounts pre-tax
|
|
294
|
-
Example: 89.99
|
|
295
|
-
|
|
296
|
-
- **`display_item_total`** (`string`) — Formatted item total with currency
|
|
297
|
-
Example: "$89.99"
|
|
298
|
-
|
|
299
|
-
- **`adjustment_total`** (`decimal`) — Sum of all adjustments
|
|
300
|
-
Example: -10.00
|
|
301
|
-
|
|
302
|
-
- **`display_adjustment_total`** (`string`) — Formatted adjustment total with currency
|
|
303
|
-
Example: "-$10.00"
|
|
304
|
-
|
|
305
|
-
- **`tax_total`** (`decimal`) — Sum of all tax amounts
|
|
306
|
-
Example: 13.25
|
|
307
|
-
|
|
308
|
-
- **`display_tax_total`** (`string`) — Formatted tax total with currency
|
|
309
|
-
Example: "$13.25"
|
|
310
|
-
|
|
311
|
-
- **`shipment_total`** (`decimal`) — Sum of shipment amounts
|
|
312
|
-
Example: 10.00
|
|
313
|
-
|
|
314
|
-
- **`display_shipment_total`** (`string`) — Formatted shipment total with currency
|
|
315
|
-
Example: "$10.00"
|
|
316
|
-
|
|
317
|
-
- **`promo_total`** (`decimal`) — Sum of all promotion adjustments
|
|
318
|
-
Example: -15.00
|
|
319
|
-
|
|
320
|
-
- **`display_promo_total`** (`string`) — Formatted promotion total with currency
|
|
321
|
-
Example: "-$15.00"
|
|
322
|
-
|
|
323
|
-
- **`included_tax_total`** (`decimal`) — Sum of included tax amounts
|
|
324
|
-
Example: 8.25
|
|
325
|
-
|
|
326
|
-
- **`additional_tax_total`** (`decimal`) — Sum of additional tax amounts
|
|
327
|
-
Example: 5.00
|
|
328
|
-
|
|
329
|
-
- **`payment_total`** (`decimal`) — Sum of completed payment amounts
|
|
330
|
-
Example: 99.99
|
|
331
|
-
|
|
332
|
-
- **`state`** (`string`) — Current order state
|
|
333
|
-
Example: `cart`
|
|
334
|
-
|
|
335
|
-
- **`email`** (`string`) — Customer email address
|
|
336
|
-
Example: `customer@example.com`
|
|
337
|
-
|
|
338
|
-
- **`user_id`** (`integer`) — Associated user ID
|
|
339
|
-
Example: 123
|
|
340
|
-
|
|
341
|
-
- **`user`** (`Spree::User`) — Associated user object
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
<details>
|
|
345
|
-
<summary>properties</summary>
|
|
346
|
-
|
|
347
|
-
- **`id`** (`integer`) — User ID
|
|
348
|
-
Example: 123
|
|
349
|
-
|
|
350
|
-
- **`email`** (`string`) — User email address
|
|
351
|
-
Example: `customer@example.com`
|
|
352
|
-
|
|
353
|
-
- **`first_name`** (`string`) — User first name
|
|
354
|
-
Example: `John`
|
|
355
|
-
|
|
356
|
-
- **`last_name`** (`string`) — User last name
|
|
357
|
-
Example: `Doe`
|
|
358
|
-
|
|
359
|
-
- **`bill_address`** (`Spree::Address`) — Default billing address object
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
<details>
|
|
363
|
-
<summary>properties</summary>
|
|
364
|
-
|
|
365
|
-
- **`id`** (`integer`) — Address ID
|
|
366
|
-
Example: 456
|
|
367
|
-
|
|
368
|
-
- **`address1`** (`string`) — Address line 1
|
|
369
|
-
Example: `123 Main St`
|
|
370
|
-
|
|
371
|
-
- **`address2`** (`string`) — Address line 2
|
|
372
|
-
Example: `Apt 1`
|
|
373
|
-
|
|
374
|
-
- **`city`** (`string`) — City
|
|
375
|
-
Example: `Anytown`
|
|
376
|
-
|
|
377
|
-
- **`zipcode`** (`string`) — Zipcode
|
|
378
|
-
Example: `12345`
|
|
379
|
-
|
|
380
|
-
- **`state`** (`Spree::State`) — State object, if the country requires a state.
|
|
381
|
-
<details>
|
|
382
|
-
<summary>properties</summary>
|
|
383
|
-
|
|
384
|
-
- **`id`** (`integer`) — State ID
|
|
385
|
-
Example: 1
|
|
386
|
-
|
|
387
|
-
- **`name`** (`string`) — State name
|
|
388
|
-
Example: `California`
|
|
389
|
-
|
|
390
|
-
- **`abbr`** (`string`) — State abbreviation
|
|
391
|
-
Example: `CA`
|
|
392
|
-
|
|
393
|
-
- **`country_id`** (`integer`) — Country ID
|
|
394
|
-
Example: 1
|
|
395
|
-
|
|
396
|
-
</details>
|
|
397
|
-
|
|
398
|
-
- **`state_name`** (`string`) — State name, used when the country doesn't require a state object
|
|
399
|
-
Example: `Some Province`
|
|
400
|
-
|
|
401
|
-
- **`state_text`** (`string`) — Returns either state.name (if state is present) or state_name
|
|
402
|
-
Example: `California` or `Some Province`
|
|
403
|
-
|
|
404
|
-
- **`country_name`** (`string`) — Country name
|
|
405
|
-
Example: `United States`
|
|
406
|
-
|
|
407
|
-
- **`country_iso`** (`string`) — Country ISO code
|
|
408
|
-
Example: `US`
|
|
409
|
-
|
|
410
|
-
- **`country`** (`Spree::Country`) — Country object
|
|
411
|
-
<details>
|
|
412
|
-
<summary>properties</summary>
|
|
413
|
-
|
|
414
|
-
- **`id`** (`integer`) — Country ID
|
|
415
|
-
Example: 1
|
|
416
|
-
|
|
417
|
-
- **`name`** (`string`) — Country name
|
|
418
|
-
Example: `United States`
|
|
419
|
-
|
|
420
|
-
- **`iso3`** (`string`) — Country ISO3 code
|
|
421
|
-
Example: `USA`
|
|
422
|
-
|
|
423
|
-
- **`iso`** (`string`) — Country ISO code
|
|
424
|
-
Example: `US`
|
|
425
|
-
|
|
426
|
-
- **`iso_name`** (`string`) — Country ISO name
|
|
427
|
-
Example: `UNITED STATES`
|
|
428
|
-
|
|
429
|
-
- **`states_required`** (`boolean`) — Whether states are required for this country
|
|
430
|
-
Example: `true`
|
|
431
|
-
|
|
432
|
-
- **`zipcode_required`** (`boolean`) — Whether zipcodes are required for this country
|
|
433
|
-
Example: `true`
|
|
434
|
-
|
|
435
|
-
</details>
|
|
436
|
-
|
|
437
|
-
</details>
|
|
438
|
-
|
|
439
|
-
- **`ship_address`** (`Spree::Address`) — Default shipping address object
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
<details>
|
|
443
|
-
<summary>properties</summary>
|
|
444
|
-
|
|
445
|
-
- **`id`** (`integer`) — Address ID
|
|
446
|
-
Example: 456
|
|
447
|
-
|
|
448
|
-
- **`address1`** (`string`) — Address line 1
|
|
449
|
-
Example: `123 Main St`
|
|
450
|
-
|
|
451
|
-
- **`address2`** (`string`) — Address line 2
|
|
452
|
-
Example: `Apt 1`
|
|
453
|
-
|
|
454
|
-
- **`city`** (`string`) — City
|
|
455
|
-
Example: `Anytown`
|
|
456
|
-
|
|
457
|
-
- **`zipcode`** (`string`) — Zipcode
|
|
458
|
-
Example: `12345`
|
|
459
|
-
|
|
460
|
-
- **`state`** (`Spree::State`) — State object, if the country requires a state.
|
|
461
|
-
<details>
|
|
462
|
-
<summary>properties</summary>
|
|
463
|
-
|
|
464
|
-
- **`id`** (`integer`) — State ID
|
|
465
|
-
Example: 1
|
|
466
|
-
|
|
467
|
-
- **`name`** (`string`) — State name
|
|
468
|
-
Example: `California`
|
|
469
|
-
|
|
470
|
-
- **`abbr`** (`string`) — State abbreviation
|
|
471
|
-
Example: `CA`
|
|
472
|
-
|
|
473
|
-
- **`country_id`** (`integer`) — Country ID
|
|
474
|
-
Example: 1
|
|
475
|
-
|
|
476
|
-
</details>
|
|
477
|
-
|
|
478
|
-
- **`state_name`** (`string`) — State name, used when the country doesn't require a state object
|
|
479
|
-
Example: `Some Province`
|
|
480
|
-
|
|
481
|
-
- **`state_text`** (`string`) — Returns either state.name (if state is present) or state_name
|
|
482
|
-
Example: `California` or `Some Province`
|
|
483
|
-
|
|
484
|
-
- **`country_name`** (`string`) — Country name
|
|
485
|
-
Example: `United States`
|
|
486
|
-
|
|
487
|
-
- **`country_iso`** (`string`) — Country ISO code
|
|
488
|
-
Example: `US`
|
|
489
|
-
|
|
490
|
-
- **`country`** (`Spree::Country`) — Country object
|
|
491
|
-
<details>
|
|
492
|
-
<summary>properties</summary>
|
|
493
|
-
|
|
494
|
-
- **`id`** (`integer`) — Country ID
|
|
495
|
-
Example: 1
|
|
496
|
-
|
|
497
|
-
- **`name`** (`string`) — Country name
|
|
498
|
-
Example: `United States`
|
|
499
|
-
|
|
500
|
-
- **`iso3`** (`string`) — Country ISO3 code
|
|
501
|
-
Example: `USA`
|
|
502
|
-
|
|
503
|
-
- **`iso`** (`string`) — Country ISO code
|
|
504
|
-
Example: `US`
|
|
505
|
-
|
|
506
|
-
- **`iso_name`** (`string`) — Country ISO name
|
|
507
|
-
Example: `UNITED STATES`
|
|
508
|
-
|
|
509
|
-
- **`states_required`** (`boolean`) — Whether states are required for this country
|
|
510
|
-
Example: `true`
|
|
511
|
-
|
|
512
|
-
- **`zipcode_required`** (`boolean`) — Whether zipcodes are required for this country
|
|
513
|
-
Example: `true`
|
|
514
|
-
|
|
515
|
-
</details>
|
|
516
|
-
|
|
517
|
-
</details>
|
|
518
|
-
|
|
519
|
-
- **`tag_list`** (`array`) — User tags (tags are used manageable by store admins)
|
|
520
|
-
Example:
|
|
521
|
-
|
|
522
|
-
```ruby
|
|
523
|
-
["vip", "wholesale"]
|
|
524
|
-
```
|
|
525
|
-
|
|
526
|
-
</details>
|
|
527
|
-
|
|
528
|
-
- **`completed_at`** (`datetime`) — When the order was completed (placed and paid). For orders in `cart` state, this will be `nil`.
|
|
529
|
-
Example: `2023-06-15 13:45:00`
|
|
530
|
-
|
|
531
|
-
- **`bill_address_id`** (`integer`) — Billing address ID
|
|
532
|
-
Example: 456
|
|
533
|
-
|
|
534
|
-
- **`bill_address`** (`Spree::Address`) — Billing address object
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
<details>
|
|
538
|
-
<summary>properties</summary>
|
|
539
|
-
|
|
540
|
-
- **`id`** (`integer`) — Address ID
|
|
541
|
-
Example: 456
|
|
542
|
-
|
|
543
|
-
- **`address1`** (`string`) — Address line 1
|
|
544
|
-
Example: `123 Main St`
|
|
545
|
-
|
|
546
|
-
- **`address2`** (`string`) — Address line 2
|
|
547
|
-
Example: `Apt 1`
|
|
548
|
-
|
|
549
|
-
- **`city`** (`string`) — City
|
|
550
|
-
Example: `Anytown`
|
|
551
|
-
|
|
552
|
-
- **`zipcode`** (`string`) — Zipcode
|
|
553
|
-
Example: `12345`
|
|
554
|
-
|
|
555
|
-
- **`state`** (`Spree::State`) — State object, if the country requires a state.
|
|
556
|
-
<details>
|
|
557
|
-
<summary>properties</summary>
|
|
558
|
-
|
|
559
|
-
- **`id`** (`integer`) — State ID
|
|
560
|
-
Example: 1
|
|
561
|
-
|
|
562
|
-
- **`name`** (`string`) — State name
|
|
563
|
-
Example: `California`
|
|
564
|
-
|
|
565
|
-
- **`abbr`** (`string`) — State abbreviation
|
|
566
|
-
Example: `CA`
|
|
567
|
-
|
|
568
|
-
- **`country_id`** (`integer`) — Country ID
|
|
569
|
-
Example: 1
|
|
570
|
-
|
|
571
|
-
</details>
|
|
572
|
-
|
|
573
|
-
- **`state_name`** (`string`) — State name, used when the country doesn't require a state object
|
|
574
|
-
Example: `Some Province`
|
|
575
|
-
|
|
576
|
-
- **`state_text`** (`string`) — Returns either state.name (if state is present) or state_name
|
|
577
|
-
Example: `California` or `Some Province`
|
|
578
|
-
|
|
579
|
-
- **`country_name`** (`string`) — Country name
|
|
580
|
-
Example: `United States`
|
|
581
|
-
|
|
582
|
-
- **`country_iso`** (`string`) — Country ISO code
|
|
583
|
-
Example: `US`
|
|
584
|
-
|
|
585
|
-
- **`country`** (`Spree::Country`) — Country object
|
|
586
|
-
<details>
|
|
587
|
-
<summary>properties</summary>
|
|
588
|
-
|
|
589
|
-
- **`id`** (`integer`) — Country ID
|
|
590
|
-
Example: 1
|
|
591
|
-
|
|
592
|
-
- **`name`** (`string`) — Country name
|
|
593
|
-
Example: `United States`
|
|
594
|
-
|
|
595
|
-
- **`iso3`** (`string`) — Country ISO3 code
|
|
596
|
-
Example: `USA`
|
|
597
|
-
|
|
598
|
-
- **`iso`** (`string`) — Country ISO code
|
|
599
|
-
Example: `US`
|
|
600
|
-
|
|
601
|
-
- **`iso_name`** (`string`) — Country ISO name
|
|
602
|
-
Example: `UNITED STATES`
|
|
603
|
-
|
|
604
|
-
- **`states_required`** (`boolean`) — Whether states are required for this country
|
|
605
|
-
Example: `true`
|
|
606
|
-
|
|
607
|
-
- **`zipcode_required`** (`boolean`) — Whether zipcodes are required for this country
|
|
608
|
-
Example: `true`
|
|
609
|
-
|
|
610
|
-
</details>
|
|
611
|
-
|
|
612
|
-
</details>
|
|
613
|
-
|
|
614
|
-
- **`ship_address_id`** (`integer`) — Shipping address ID
|
|
615
|
-
Example: 457
|
|
616
|
-
|
|
617
|
-
- **`ship_address`** (`Spree::Address`) — Shipping address object
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
<details>
|
|
621
|
-
<summary>properties</summary>
|
|
622
|
-
|
|
623
|
-
- **`id`** (`integer`) — Address ID
|
|
624
|
-
Example: 456
|
|
625
|
-
|
|
626
|
-
- **`address1`** (`string`) — Address line 1
|
|
627
|
-
Example: `123 Main St`
|
|
628
|
-
|
|
629
|
-
- **`address2`** (`string`) — Address line 2
|
|
630
|
-
Example: `Apt 1`
|
|
631
|
-
|
|
632
|
-
- **`city`** (`string`) — City
|
|
633
|
-
Example: `Anytown`
|
|
634
|
-
|
|
635
|
-
- **`zipcode`** (`string`) — Zipcode
|
|
636
|
-
Example: `12345`
|
|
637
|
-
|
|
638
|
-
- **`state`** (`Spree::State`) — State object, if the country requires a state.
|
|
639
|
-
<details>
|
|
640
|
-
<summary>properties</summary>
|
|
641
|
-
|
|
642
|
-
- **`id`** (`integer`) — State ID
|
|
643
|
-
Example: 1
|
|
644
|
-
|
|
645
|
-
- **`name`** (`string`) — State name
|
|
646
|
-
Example: `California`
|
|
647
|
-
|
|
648
|
-
- **`abbr`** (`string`) — State abbreviation
|
|
649
|
-
Example: `CA`
|
|
650
|
-
|
|
651
|
-
- **`country_id`** (`integer`) — Country ID
|
|
652
|
-
Example: 1
|
|
653
|
-
|
|
654
|
-
</details>
|
|
655
|
-
|
|
656
|
-
- **`state_name`** (`string`) — State name, used when the country doesn't require a state object
|
|
657
|
-
Example: `Some Province`
|
|
658
|
-
|
|
659
|
-
- **`state_text`** (`string`) — Returns either state.name (if state is present) or state_name
|
|
660
|
-
Example: `California` or `Some Province`
|
|
661
|
-
|
|
662
|
-
- **`country_name`** (`string`) — Country name
|
|
663
|
-
Example: `United States`
|
|
664
|
-
|
|
665
|
-
- **`country_iso`** (`string`) — Country ISO code
|
|
666
|
-
Example: `US`
|
|
667
|
-
|
|
668
|
-
- **`country`** (`Spree::Country`) — Country object
|
|
669
|
-
<details>
|
|
670
|
-
<summary>properties</summary>
|
|
671
|
-
|
|
672
|
-
- **`id`** (`integer`) — Country ID
|
|
673
|
-
Example: 1
|
|
674
|
-
|
|
675
|
-
- **`name`** (`string`) — Country name
|
|
676
|
-
Example: `United States`
|
|
677
|
-
|
|
678
|
-
- **`iso3`** (`string`) — Country ISO3 code
|
|
679
|
-
Example: `USA`
|
|
680
|
-
|
|
681
|
-
- **`iso`** (`string`) — Country ISO code
|
|
682
|
-
Example: `US`
|
|
683
|
-
|
|
684
|
-
- **`iso_name`** (`string`) — Country ISO name
|
|
685
|
-
Example: `UNITED STATES`
|
|
686
|
-
|
|
687
|
-
- **`states_required`** (`boolean`) — Whether states are required for this country
|
|
688
|
-
Example: `true`
|
|
689
|
-
|
|
690
|
-
- **`zipcode_required`** (`boolean`) — Whether zipcodes are required for this country
|
|
691
|
-
Example: `true`
|
|
692
|
-
|
|
693
|
-
</details>
|
|
694
|
-
|
|
695
|
-
</details>
|
|
696
|
-
|
|
697
|
-
- **`payment_state`** (`string`) — Payment state (balance_due, credit_owed, failed, paid, void)
|
|
698
|
-
Example: `paid`
|
|
699
|
-
|
|
700
|
-
- **`shipment_state`** (`string`) — Shipment state (backorder, canceled, partial, pending, ready, shipped)
|
|
701
|
-
Example: `shipped`
|
|
702
|
-
|
|
703
|
-
- **`currency`** (`string`) — Order currency
|
|
704
|
-
Example: `USD`
|
|
705
|
-
|
|
706
|
-
- **`store_id`** (`integer`) — Associated store ID
|
|
707
|
-
Example: 1
|
|
708
|
-
|
|
709
|
-
- **`items`** (`array`) — Line items in the order
|
|
710
|
-
|
|
711
|
-
<details>
|
|
712
|
-
<summary>properties</summary>
|
|
713
|
-
|
|
714
|
-
- **`id`** (`integer`) — Line item ID
|
|
715
|
-
Example: 123
|
|
716
|
-
|
|
717
|
-
- **`quantity`** (`integer`) — Quantity of the variant ordered
|
|
718
|
-
Example: 2
|
|
719
|
-
|
|
720
|
-
- **`price`** (`decimal`) — Unit price of the variant when ordered
|
|
721
|
-
Example: 29.99
|
|
722
|
-
|
|
723
|
-
- **`display_price`** (`string`) — Formatted unit price with currency
|
|
724
|
-
Example: "$29.99"
|
|
725
|
-
|
|
726
|
-
- **`total`** (`decimal`) — Total price for this line item (quantity * price)
|
|
727
|
-
Example: 59.98
|
|
728
|
-
|
|
729
|
-
- **`display_total`** (`string`) — Formatted total price with currency
|
|
730
|
-
Example: "$59.98"
|
|
731
|
-
|
|
732
|
-
- **`adjustment_total`** (`decimal`) — Sum of all adjustments for this line item
|
|
733
|
-
Example: -5.00
|
|
734
|
-
|
|
735
|
-
- **`display_adjustment_total`** (`string`) — Formatted adjustment total with currency
|
|
736
|
-
Example: "-$5.00"
|
|
737
|
-
|
|
738
|
-
- **`additional_tax_total`** (`decimal`) — Sum of additional tax amounts
|
|
739
|
-
Example: 4.50
|
|
740
|
-
|
|
741
|
-
- **`included_tax_total`** (`decimal`) — Sum of included tax amounts
|
|
742
|
-
Example: 2.75
|
|
743
|
-
|
|
744
|
-
- **`promo_total`** (`decimal`) — Sum of promotion adjustments
|
|
745
|
-
Example: -10.00
|
|
746
|
-
|
|
747
|
-
- **`display_promo_total`** (`string`) — Formatted promotion total with currency
|
|
748
|
-
Example: "-$10.00"
|
|
749
|
-
|
|
750
|
-
- **`order_id`** (`integer`) — Associated order ID
|
|
751
|
-
Example: 456
|
|
752
|
-
|
|
753
|
-
- **`variant`** (`Spree::Variant`) — Associated product variant
|
|
754
|
-
<details>
|
|
755
|
-
<summary>properties</summary>
|
|
756
|
-
|
|
757
|
-
- **`id`** (`integer`) — Variant ID
|
|
758
|
-
Example: 123
|
|
759
|
-
|
|
760
|
-
- **`sku`** (`string`) — Stock Keeping Unit - unique identifier for the variant
|
|
761
|
-
Example: "ABC-123"
|
|
762
|
-
|
|
763
|
-
- **`name`** (`string`) — Name of the variant (inherited from product)
|
|
764
|
-
Example: "Basic T-Shirt"
|
|
765
|
-
|
|
766
|
-
- **`options_text`** (`string`) — Formatted string of option values
|
|
767
|
-
Example: "Size: Large, Color: Blue"
|
|
768
|
-
|
|
769
|
-
- **`descriptive_name`** (`string`) — Full descriptive name including master status or options
|
|
770
|
-
Example: "Basic T-Shirt - Size: Large, Color: Blue"
|
|
771
|
-
|
|
772
|
-
- **`price`** (`decimal`) — Base price of the variant
|
|
773
|
-
Example: 29.99
|
|
774
|
-
|
|
775
|
-
- **`display_price`** (`string`) — Formatted price with currency
|
|
776
|
-
Example: "$29.99"
|
|
777
|
-
|
|
778
|
-
- **`weight`** (`decimal`) — Weight of the variant
|
|
779
|
-
Example: 1.5
|
|
780
|
-
|
|
781
|
-
- **`height`** (`decimal`) — Height of the variant
|
|
782
|
-
Example: 10.0
|
|
783
|
-
|
|
784
|
-
- **`width`** (`decimal`) — Width of the variant
|
|
785
|
-
Example: 5.0
|
|
786
|
-
|
|
787
|
-
- **`depth`** (`decimal`) — Depth of the variant
|
|
788
|
-
Example: 2.0
|
|
789
|
-
|
|
790
|
-
- **`is_master`** (`boolean`) — Whether this is the master variant of the product
|
|
791
|
-
Example: false
|
|
792
|
-
|
|
793
|
-
- **`position`** (`integer`) — Display order position
|
|
794
|
-
Example: 1
|
|
795
|
-
|
|
796
|
-
- **`track_inventory`** (`boolean`) — Whether inventory tracking is enabled for this variant
|
|
797
|
-
Example: true
|
|
798
|
-
|
|
799
|
-
- **`available?`** (`boolean`) — Whether the variant is available for purchase (not discontinued and product is available)
|
|
800
|
-
Example: true
|
|
801
|
-
|
|
802
|
-
- **`in_stock?`** (`boolean`) — Whether the variant currently has stock available
|
|
803
|
-
Example: true
|
|
804
|
-
|
|
805
|
-
- **`tax_category_id`** (`integer`) — ID of the associated tax category
|
|
806
|
-
Example: 1
|
|
807
|
-
|
|
808
|
-
- **`cost_price`** (`decimal`) — Cost price of the variant
|
|
809
|
-
Example: 15.00
|
|
810
|
-
|
|
811
|
-
- **`cost_currency`** (`string`) — Currency of the cost price
|
|
812
|
-
Example: "USD"
|
|
813
|
-
|
|
814
|
-
- **`product_id`** (`integer`) — ID of the associated product
|
|
815
|
-
Example: 456
|
|
816
|
-
|
|
817
|
-
</details>
|
|
818
|
-
|
|
819
|
-
- **`currency`** (`string`) — Currency of the line item
|
|
820
|
-
Example: "USD"
|
|
821
|
-
|
|
822
|
-
</details>
|
|
823
|
-
|
|
824
|
-
</details>
|
|
825
|
-
|
|
826
|
-
Returns the current order object. If no order is found, it will return `nil`.
|
|
827
|
-
|
|
828
|
-
> **TIP:** Order is automatically created when a user adds a product to the cart.
|
|
829
|
-
|
|
830
|
-
### `try_spree_current_user`
|
|
831
|
-
|
|
832
|
-
<details>
|
|
833
|
-
<summary>properties</summary>
|
|
834
|
-
|
|
835
|
-
- **`id`** (`integer`) — User ID
|
|
836
|
-
Example: 123
|
|
837
|
-
|
|
838
|
-
- **`email`** (`string`) — User email address
|
|
839
|
-
Example: `customer@example.com`
|
|
840
|
-
|
|
841
|
-
- **`first_name`** (`string`) — User first name
|
|
842
|
-
Example: `John`
|
|
843
|
-
|
|
844
|
-
- **`last_name`** (`string`) — User last name
|
|
845
|
-
Example: `Doe`
|
|
846
|
-
|
|
847
|
-
- **`bill_address`** (`Spree::Address`) — Default billing address object
|
|
848
|
-
|
|
849
|
-
|
|
850
|
-
<details>
|
|
851
|
-
<summary>properties</summary>
|
|
852
|
-
|
|
853
|
-
- **`id`** (`integer`) — Address ID
|
|
854
|
-
Example: 456
|
|
855
|
-
|
|
856
|
-
- **`address1`** (`string`) — Address line 1
|
|
857
|
-
Example: `123 Main St`
|
|
858
|
-
|
|
859
|
-
- **`address2`** (`string`) — Address line 2
|
|
860
|
-
Example: `Apt 1`
|
|
861
|
-
|
|
862
|
-
- **`city`** (`string`) — City
|
|
863
|
-
Example: `Anytown`
|
|
864
|
-
|
|
865
|
-
- **`zipcode`** (`string`) — Zipcode
|
|
866
|
-
Example: `12345`
|
|
867
|
-
|
|
868
|
-
- **`state`** (`Spree::State`) — State object, if the country requires a state.
|
|
869
|
-
<details>
|
|
870
|
-
<summary>properties</summary>
|
|
871
|
-
|
|
872
|
-
- **`id`** (`integer`) — State ID
|
|
873
|
-
Example: 1
|
|
874
|
-
|
|
875
|
-
- **`name`** (`string`) — State name
|
|
876
|
-
Example: `California`
|
|
877
|
-
|
|
878
|
-
- **`abbr`** (`string`) — State abbreviation
|
|
879
|
-
Example: `CA`
|
|
880
|
-
|
|
881
|
-
- **`country_id`** (`integer`) — Country ID
|
|
882
|
-
Example: 1
|
|
883
|
-
|
|
884
|
-
</details>
|
|
885
|
-
|
|
886
|
-
- **`state_name`** (`string`) — State name, used when the country doesn't require a state object
|
|
887
|
-
Example: `Some Province`
|
|
888
|
-
|
|
889
|
-
- **`state_text`** (`string`) — Returns either state.name (if state is present) or state_name
|
|
890
|
-
Example: `California` or `Some Province`
|
|
891
|
-
|
|
892
|
-
- **`country_name`** (`string`) — Country name
|
|
893
|
-
Example: `United States`
|
|
894
|
-
|
|
895
|
-
- **`country_iso`** (`string`) — Country ISO code
|
|
896
|
-
Example: `US`
|
|
897
|
-
|
|
898
|
-
- **`country`** (`Spree::Country`) — Country object
|
|
899
|
-
<details>
|
|
900
|
-
<summary>properties</summary>
|
|
901
|
-
|
|
902
|
-
- **`id`** (`integer`) — Country ID
|
|
903
|
-
Example: 1
|
|
904
|
-
|
|
905
|
-
- **`name`** (`string`) — Country name
|
|
906
|
-
Example: `United States`
|
|
907
|
-
|
|
908
|
-
- **`iso3`** (`string`) — Country ISO3 code
|
|
909
|
-
Example: `USA`
|
|
910
|
-
|
|
911
|
-
- **`iso`** (`string`) — Country ISO code
|
|
912
|
-
Example: `US`
|
|
913
|
-
|
|
914
|
-
- **`iso_name`** (`string`) — Country ISO name
|
|
915
|
-
Example: `UNITED STATES`
|
|
916
|
-
|
|
917
|
-
- **`states_required`** (`boolean`) — Whether states are required for this country
|
|
918
|
-
Example: `true`
|
|
919
|
-
|
|
920
|
-
- **`zipcode_required`** (`boolean`) — Whether zipcodes are required for this country
|
|
921
|
-
Example: `true`
|
|
922
|
-
|
|
923
|
-
</details>
|
|
924
|
-
|
|
925
|
-
</details>
|
|
926
|
-
|
|
927
|
-
- **`ship_address`** (`Spree::Address`) — Default shipping address object
|
|
928
|
-
|
|
929
|
-
|
|
930
|
-
<details>
|
|
931
|
-
<summary>properties</summary>
|
|
932
|
-
|
|
933
|
-
- **`id`** (`integer`) — Address ID
|
|
934
|
-
Example: 456
|
|
935
|
-
|
|
936
|
-
- **`address1`** (`string`) — Address line 1
|
|
937
|
-
Example: `123 Main St`
|
|
938
|
-
|
|
939
|
-
- **`address2`** (`string`) — Address line 2
|
|
940
|
-
Example: `Apt 1`
|
|
941
|
-
|
|
942
|
-
- **`city`** (`string`) — City
|
|
943
|
-
Example: `Anytown`
|
|
944
|
-
|
|
945
|
-
- **`zipcode`** (`string`) — Zipcode
|
|
946
|
-
Example: `12345`
|
|
947
|
-
|
|
948
|
-
- **`state`** (`Spree::State`) — State object, if the country requires a state.
|
|
949
|
-
<details>
|
|
950
|
-
<summary>properties</summary>
|
|
951
|
-
|
|
952
|
-
- **`id`** (`integer`) — State ID
|
|
953
|
-
Example: 1
|
|
954
|
-
|
|
955
|
-
- **`name`** (`string`) — State name
|
|
956
|
-
Example: `California`
|
|
957
|
-
|
|
958
|
-
- **`abbr`** (`string`) — State abbreviation
|
|
959
|
-
Example: `CA`
|
|
960
|
-
|
|
961
|
-
- **`country_id`** (`integer`) — Country ID
|
|
962
|
-
Example: 1
|
|
963
|
-
|
|
964
|
-
</details>
|
|
965
|
-
|
|
966
|
-
- **`state_name`** (`string`) — State name, used when the country doesn't require a state object
|
|
967
|
-
Example: `Some Province`
|
|
968
|
-
|
|
969
|
-
- **`state_text`** (`string`) — Returns either state.name (if state is present) or state_name
|
|
970
|
-
Example: `California` or `Some Province`
|
|
971
|
-
|
|
972
|
-
- **`country_name`** (`string`) — Country name
|
|
973
|
-
Example: `United States`
|
|
974
|
-
|
|
975
|
-
- **`country_iso`** (`string`) — Country ISO code
|
|
976
|
-
Example: `US`
|
|
977
|
-
|
|
978
|
-
- **`country`** (`Spree::Country`) — Country object
|
|
979
|
-
<details>
|
|
980
|
-
<summary>properties</summary>
|
|
981
|
-
|
|
982
|
-
- **`id`** (`integer`) — Country ID
|
|
983
|
-
Example: 1
|
|
984
|
-
|
|
985
|
-
- **`name`** (`string`) — Country name
|
|
986
|
-
Example: `United States`
|
|
987
|
-
|
|
988
|
-
- **`iso3`** (`string`) — Country ISO3 code
|
|
989
|
-
Example: `USA`
|
|
990
|
-
|
|
991
|
-
- **`iso`** (`string`) — Country ISO code
|
|
992
|
-
Example: `US`
|
|
993
|
-
|
|
994
|
-
- **`iso_name`** (`string`) — Country ISO name
|
|
995
|
-
Example: `UNITED STATES`
|
|
996
|
-
|
|
997
|
-
- **`states_required`** (`boolean`) — Whether states are required for this country
|
|
998
|
-
Example: `true`
|
|
999
|
-
|
|
1000
|
-
- **`zipcode_required`** (`boolean`) — Whether zipcodes are required for this country
|
|
1001
|
-
Example: `true`
|
|
1002
|
-
|
|
1003
|
-
</details>
|
|
1004
|
-
|
|
1005
|
-
</details>
|
|
1006
|
-
|
|
1007
|
-
- **`tag_list`** (`array`) — User tags (tags are used manageable by store admins)
|
|
1008
|
-
Example:
|
|
1009
|
-
|
|
1010
|
-
```ruby
|
|
1011
|
-
["vip", "wholesale"]
|
|
1012
|
-
```
|
|
1013
|
-
|
|
1014
|
-
</details>
|
|
1015
|
-
|
|
1016
|
-
Returns the current user object (class depends on the `Spree.user_class` configuration). If the user is not signed in, it will return `nil`.
|
|
1017
|
-
|
|
1018
|
-
> **TIP:** If you want to check if the user is signed in, you can use the following:
|
|
1019
|
-
>
|
|
1020
|
-
> ```erb
|
|
1021
|
-
<%= try_spree_current_user.present? %>
|
|
1022
|
-
```
|
|
1023
|
-
|
|
1024
|
-
### `current_currency`
|
|
1025
|
-
|
|
1026
|
-
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.
|
|
1027
|
-
|
|
1028
|
-
```erb
|
|
1029
|
-
<%= current_currency %>
|
|
1030
|
-
```
|
|
1031
|
-
|
|
1032
|
-
will return
|
|
1033
|
-
|
|
1034
|
-
```
|
|
1035
|
-
USD
|
|
1036
|
-
```
|
|
1037
|
-
|
|
1038
|
-
### `current_locale`
|
|
1039
|
-
|
|
1040
|
-
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.
|
|
1041
|
-
|
|
1042
|
-
```erb
|
|
1043
|
-
<%= current_locale %>
|
|
1044
|
-
```
|
|
1045
|
-
|
|
1046
|
-
> **INFO:** 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`.
|
|
1047
|
-
|
|
1048
|
-
### `current_taxon`
|
|
1049
|
-
|
|
1050
|
-
Returns the current taxon when viewing a category/collection page.
|
|
1051
|
-
|
|
1052
|
-
```erb
|
|
1053
|
-
<%= current_taxon&.name %>
|
|
1054
|
-
```
|
|
1055
|
-
|
|
1056
|
-
### `current_wishlist`
|
|
1057
|
-
|
|
1058
|
-
Returns the current user's default wishlist for the current store.
|
|
1059
|
-
|
|
1060
|
-
```erb
|
|
1061
|
-
<% if current_wishlist.present? %>
|
|
1062
|
-
<%= current_wishlist.wished_items.count %> items
|
|
1063
|
-
<% end %>
|
|
1064
|
-
```
|
|
1065
|
-
|
|
1066
|
-
## Page Rendering Helpers
|
|
1067
|
-
|
|
1068
|
-
### `render_page`
|
|
1069
|
-
|
|
1070
|
-
Renders a page with all its sections. This is the main method for rendering page content.
|
|
1071
|
-
|
|
1072
|
-
```erb
|
|
1073
|
-
<%= render_page(current_page, pickup_locations: @pickup_locations) %>
|
|
1074
|
-
```
|
|
1075
|
-
|
|
1076
|
-
**Parameters:**
|
|
1077
|
-
- `page` - The page to render (defaults to `current_page`)
|
|
1078
|
-
- `variables` - Hash of variables to pass to section templates
|
|
1079
|
-
|
|
1080
|
-
### `render_section`
|
|
1081
|
-
|
|
1082
|
-
Renders a single section.
|
|
1083
|
-
|
|
1084
|
-
```erb
|
|
1085
|
-
<%= render_section(section, product: @product) %>
|
|
1086
|
-
```
|
|
1087
|
-
|
|
1088
|
-
### `render_header_sections`
|
|
1089
|
-
|
|
1090
|
-
Renders all header sections (announcement bar, header).
|
|
1091
|
-
|
|
1092
|
-
```erb
|
|
1093
|
-
<%= render_header_sections %>
|
|
1094
|
-
```
|
|
1095
|
-
|
|
1096
|
-
### `render_footer_sections`
|
|
1097
|
-
|
|
1098
|
-
Renders all footer sections (newsletter, footer).
|
|
1099
|
-
|
|
1100
|
-
```erb
|
|
1101
|
-
<%= render_footer_sections %>
|
|
1102
|
-
```
|
|
1103
|
-
|
|
1104
|
-
## Section & Block Helpers
|
|
1105
|
-
|
|
1106
|
-
### `section_styles`
|
|
1107
|
-
|
|
1108
|
-
Returns inline CSS styles for a section based on its preferences (padding, colors, borders).
|
|
1109
|
-
|
|
1110
|
-
```erb
|
|
1111
|
-
<div style="<%= section_styles(section) %>">
|
|
1112
|
-
<!-- Section content -->
|
|
1113
|
-
</div>
|
|
1114
|
-
```
|
|
1115
|
-
|
|
1116
|
-
### `block_attributes`
|
|
1117
|
-
|
|
1118
|
-
Returns data attributes for a block (used for Page Builder editing).
|
|
1119
|
-
|
|
1120
|
-
```erb
|
|
1121
|
-
<h2 <%= block_attributes(block) %>>
|
|
1122
|
-
<%= block.text %>
|
|
1123
|
-
</h2>
|
|
1124
|
-
```
|
|
1125
|
-
|
|
1126
|
-
### `page_builder_enabled?`
|
|
1127
|
-
|
|
1128
|
-
Returns `true` when the page is being viewed in Page Builder preview mode.
|
|
1129
|
-
|
|
1130
|
-
```erb
|
|
1131
|
-
<% cache_unless page_builder_enabled?, cache_key do %>
|
|
1132
|
-
<!-- Cached content -->
|
|
1133
|
-
<% end %>
|
|
1134
|
-
```
|
|
1135
|
-
|
|
1136
|
-
### `page_builder_link_to`
|
|
1137
|
-
|
|
1138
|
-
Renders a link from a `Spree::PageLink` object.
|
|
1139
|
-
|
|
1140
|
-
```erb
|
|
1141
|
-
<%= page_builder_link_to section.link, class: 'btn-primary' %>
|
|
1142
|
-
|
|
1143
|
-
<%# With custom content %>
|
|
1144
|
-
<%= page_builder_link_to section.link do %>
|
|
1145
|
-
<span class="icon">→</span> Click here
|
|
1146
|
-
<% end %>
|
|
1147
|
-
```
|
|
1148
|
-
|
|
1149
|
-
## Currency & Price Helpers
|
|
1150
|
-
|
|
1151
|
-
### `supported_currencies`
|
|
1152
|
-
|
|
1153
|
-
Returns the list of supported currencies for the current store as an array of strings.
|
|
1154
|
-
|
|
1155
|
-
```erb
|
|
1156
|
-
<%= supported_currencies %>
|
|
1157
|
-
```
|
|
1158
|
-
|
|
1159
|
-
will return
|
|
1160
|
-
|
|
1161
|
-
```ruby
|
|
1162
|
-
["USD", "EUR"]
|
|
1163
|
-
```
|
|
1164
|
-
|
|
1165
|
-
### `display_price`
|
|
1166
|
-
|
|
1167
|
-
Displays a formatted price with currency symbol.
|
|
1168
|
-
|
|
1169
|
-
```erb
|
|
1170
|
-
<%= display_price(product.price_in(current_currency)) %>
|
|
1171
|
-
```
|
|
1172
|
-
|
|
1173
|
-
## Date & Time Helpers
|
|
1174
|
-
|
|
1175
|
-
### `local_time`
|
|
1176
|
-
|
|
1177
|
-
Displays a time in the user's timezone in a human readable format (based on the browser's timezone).
|
|
1178
|
-
|
|
1179
|
-
```erb
|
|
1180
|
-
<%= local_time(order.sent_to_erp_at) %>
|
|
1181
|
-
```
|
|
1182
|
-
|
|
1183
|
-
Provided by [local_time gem](https://github.com/basecamp/local_time).
|
|
1184
|
-
|
|
1185
|
-
## URL Helpers
|
|
1186
|
-
|
|
1187
|
-
### `spree_storefront_resource_url`
|
|
1188
|
-
|
|
1189
|
-
Generates a URL for a Spree resource (product, taxon, post, page).
|
|
1190
|
-
|
|
1191
|
-
```erb
|
|
1192
|
-
<%= link_to product.name, spree_storefront_resource_url(product) %>
|
|
1193
|
-
<%= link_to taxon.name, spree_storefront_resource_url(taxon) %>
|
|
1194
|
-
```
|
|
1195
|
-
|
|
1196
|
-
### `spree.nested_taxons_path`
|
|
1197
|
-
|
|
1198
|
-
Generates a URL for a taxon using its full permalink.
|
|
1199
|
-
|
|
1200
|
-
```erb
|
|
1201
|
-
<%= link_to taxon.name, spree.nested_taxons_path(taxon) %>
|
|
1202
|
-
<%# => /t/categories/clothing/shirts %>
|
|
1203
|
-
```
|
|
1204
|
-
|
|
1205
|
-
## Image Helpers
|
|
1206
|
-
|
|
1207
|
-
### `spree_image_tag`
|
|
1208
|
-
|
|
1209
|
-
Renders an optimized image tag with automatic WebP conversion and retina support.
|
|
1210
|
-
|
|
1211
|
-
```erb
|
|
1212
|
-
<%= spree_image_tag product.images.first,
|
|
1213
|
-
width: 400,
|
|
1214
|
-
height: 400,
|
|
1215
|
-
alt: product.name,
|
|
1216
|
-
loading: :lazy %>
|
|
1217
|
-
```
|
|
1218
|
-
|
|
1219
|
-
### `spree_image_url`
|
|
1220
|
-
|
|
1221
|
-
Generates a URL for an image with specified dimensions.
|
|
1222
|
-
|
|
1223
|
-
```erb
|
|
1224
|
-
<%= spree_image_url(product.images.first, width: 800, height: 600) %>
|
|
1225
|
-
```
|
|
1226
|
-
|
|
1227
|
-
> **INFO:** See [Media](/developer/core-concepts/media) for more details on image helpers.
|
|
1228
|
-
|
|
1229
|
-
## Product Helpers
|
|
1230
|
-
|
|
1231
|
-
### `taxon_products`
|
|
1232
|
-
|
|
1233
|
-
Returns products for a given taxon, useful in section templates.
|
|
1234
|
-
|
|
1235
|
-
```erb
|
|
1236
|
-
<% taxon_products(section.taxon).limit(4).each do |product| %>
|
|
1237
|
-
<%= render 'spree/products/card', product: product %>
|
|
1238
|
-
<% end %>
|
|
1239
|
-
```
|
|
1240
|
-
|
|
1241
|
-
### `storefront_products`
|
|
1242
|
-
|
|
1243
|
-
Returns products based on current filters and sorting.
|
|
1244
|
-
|
|
1245
|
-
```erb
|
|
1246
|
-
<% storefront_products.each do |product| %>
|
|
1247
|
-
<%= render 'spree/products/card', product: product %>
|
|
1248
|
-
<% end %>
|
|
1249
|
-
```
|
|
1250
|
-
|
|
1251
|
-
## Cache Helpers
|
|
1252
|
-
|
|
1253
|
-
### `spree_storefront_base_cache_key`
|
|
1254
|
-
|
|
1255
|
-
Returns the base cache key for storefront caching.
|
|
1256
|
-
|
|
1257
|
-
```erb
|
|
1258
|
-
<% cache [spree_storefront_base_cache_key, product] do %>
|
|
1259
|
-
<%= render 'product_card', product: product %>
|
|
1260
|
-
<% end %>
|
|
1261
|
-
```
|
|
1262
|
-
|
|
1263
|
-
### `spree_storefront_base_cache_scope`
|
|
1264
|
-
|
|
1265
|
-
Returns a cache scope proc for section caching.
|
|
1266
|
-
|
|
1267
|
-
```erb
|
|
1268
|
-
<% cache_unless page_builder_enabled?, spree_storefront_base_cache_scope.call(section) do %>
|
|
1269
|
-
<!-- Section content -->
|
|
1270
|
-
<% end %>
|
|
1271
|
-
```
|
|
1272
|
-
|
|
1273
|
-
## Preview Helpers
|
|
1274
|
-
|
|
1275
|
-
These helpers are used for Page Builder preview functionality:
|
|
1276
|
-
|
|
1277
|
-
| Helper | Description |
|
|
1278
|
-
|--------|-------------|
|
|
1279
|
-
| `current_theme_preview` | Returns the theme preview if in preview mode |
|
|
1280
|
-
| `current_page_preview` | Returns the page preview if in preview mode |
|
|
1281
|
-
| `current_theme_or_preview` | Returns theme preview or active theme |
|
|
1282
|
-
| `current_page_or_preview` | Returns page preview or active page |
|
|
1283
|
-
|
|
1284
|
-
## Related Documentation
|
|
1285
|
-
|
|
1286
|
-
- [Sections](/developer/storefront/sections) - Section rendering and customization
|
|
1287
|
-
- [Blocks](/developer/storefront/blocks) - Block rendering
|
|
1288
|
-
- [Media](/developer/core-concepts/media) - Image helper methods
|