@spree/docs 0.1.239 → 0.1.241
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/metadata.md +6 -6
- package/dist/developer/core-concepts/architecture.md +15 -19
- package/dist/developer/core-concepts/carts.md +71 -1
- package/dist/developer/core-concepts/metafields.md +0 -2
- package/dist/developer/create-spree-app/quickstart.md +22 -19
- package/dist/developer/customization/api.md +2 -2
- package/dist/developer/customization/checkout.md +117 -0
- package/dist/developer/customization/configuration.md +76 -175
- package/dist/developer/customization/decorators.md +120 -130
- package/dist/developer/customization/metadata.md +9 -9
- package/dist/developer/customization/model-preferences.md +34 -68
- package/dist/developer/customization/permissions.md +13 -28
- package/dist/developer/customization/validations.md +16 -43
- package/dist/developer/dashboard/concepts.md +4 -2
- package/dist/developer/dashboard/customization/backend.md +5 -2
- package/dist/developer/dashboard/customization/navigation.md +1 -1
- package/dist/developer/dashboard/customization/quickstart.md +1 -1
- package/dist/developer/dashboard/overview.md +2 -2
- package/dist/developer/dashboard/plugins/distributing.md +1 -1
- package/dist/developer/dashboard/public-api.md +3 -2
- package/dist/developer/dashboard/recipes/attribute-end-to-end.md +3 -3
- package/dist/developer/dashboard/recipes/custom-form-field.md +1 -1
- package/dist/developer/dashboard/recipes/page-action-button.md +2 -2
- package/dist/developer/dashboard/recipes/sidebar-widget.md +2 -2
- package/dist/developer/dashboard/slots-catalog.md +60 -0
- package/dist/developer/getting-started/quickstart.md +25 -24
- package/dist/developer/how-to/custom-promotion.md +1 -1
- package/dist/developer/how-to/custom-search-provider.md +2 -2
- package/dist/developer/how-to/custom-stock-splitter.md +2 -2
- package/dist/developer/sdk/admin/extending.md +1 -1
- package/dist/developer/sdk/admin/quickstart.md +1 -1
- package/dist/developer/sdk/admin/resources.md +1 -1
- package/dist/developer/sdk/configuration.md +1 -1
- package/dist/developer/sdk/extending.md +1 -1
- package/dist/developer/tutorial/testing.md +45 -91
- package/package.json +1 -1
|
@@ -1,226 +1,127 @@
|
|
|
1
1
|
---
|
|
2
2
|
title: Configuration
|
|
3
|
-
description: Every
|
|
3
|
+
description: Every Spree setting, the environment variable that sets it, and what it changes.
|
|
4
4
|
---
|
|
5
5
|
|
|
6
|
-
|
|
6
|
+
All business configuration is done in the Admin Dashboard. What is left here is a
|
|
7
|
+
small set of settings describing the *installation*: limits, expiries, and where
|
|
8
|
+
things are hosted. **Every one of them is set with an environment
|
|
9
|
+
variable**, so changing one is a config change rather than a code change.
|
|
7
10
|
|
|
8
|
-
```
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
config.allow_empty_price_amount = true
|
|
12
|
-
end
|
|
11
|
+
```bash
|
|
12
|
+
SPREE_MINIMUM_PASSWORD_LENGTH=10
|
|
13
|
+
SPREE_JWT_EXPIRATION=1800
|
|
13
14
|
```
|
|
14
15
|
|
|
15
|
-
|
|
16
|
+
Values are converted to the setting's type, so `SPREE_WEBHOOKS_ENABLED=false` really
|
|
17
|
+
is false. A value that cannot be converted — `SPREE_JWT_EXPIRATION=abc` — fails at
|
|
18
|
+
boot rather than silently reverting to the default.
|
|
16
19
|
|
|
17
|
-
|
|
20
|
+
> **NOTE:** Booleans accept `true`/`false`, `1`/`0`, `yes`/`no` and `on`/`off`, in any case.
|
|
18
21
|
|
|
19
|
-
|
|
22
|
+
## Hosting
|
|
20
23
|
|
|
21
|
-
|
|
|
24
|
+
| Variable | Default | What it does |
|
|
22
25
|
|---|---|---|
|
|
23
|
-
| `
|
|
24
|
-
| `
|
|
26
|
+
| `SPREE_DASHBOARD_URL` | — | Origin where the dashboard is hosted. Used for every link that sends someone into it — invitation emails, SSO redirects, and the first-run setup link printed by `db:seed`. |
|
|
27
|
+
| `SPREE_SELLER_PANEL_URL` | — | Origin where the marketplace seller panel is hosted, when it isn't this app's own `/sellers` mount. Unset uses `/sellers`; with no panel deployed, seller links open the dashboard. |
|
|
28
|
+
| `SPREE_STORE_SCOPE_GUARD` | `log` | Tripwire for queries that miss a store scope, in development and test only. `log` warns, `raise` fails, `off` disables. Never active in production. |
|
|
25
29
|
|
|
26
|
-
|
|
30
|
+
## Carts
|
|
27
31
|
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
Settings that shape how a shop sells — when customers are charged, whether stock is counted, which products appear without a price — are properties of a store, not of the installation, so they live on `Spree::Store` and are edited in the dashboard under **Settings → Store**:
|
|
31
|
-
|
|
32
|
-
`capture_method`, `track_inventory_levels`, `stock_reservations_enabled`, `stock_reservation_ttl_minutes`, `track_price_history`, `show_products_without_price`, `disable_sku_validation`, `address_requires_phone`, `company_field_enabled`, `tax_using_ship_address`, plus `guest_checkout` and `storefront_access` — those last two are owned by the channel, and the store's value is what a channel falls back to.
|
|
33
|
-
|
|
34
|
-
The global versions of these settings still exist but are no longer read, so setting one in the initializer changes nothing. If you're upgrading from an installation that used them, run `bin/rake spree:store_settings:backfill_from_config` to copy your values onto every store.
|
|
35
|
-
|
|
36
|
-
```ruby
|
|
37
|
-
store = Spree::Current.store
|
|
38
|
-
store.preferred_capture_method # => "checkout"
|
|
39
|
-
store.update!(preferred_track_inventory_levels: false)
|
|
40
|
-
```
|
|
41
|
-
|
|
42
|
-
### When customers are charged
|
|
43
|
-
|
|
44
|
-
`capture_method` says when a customer is charged rather than only authorized. It applies to every payment method, not just card gateways. It takes one of three values:
|
|
45
|
-
|
|
46
|
-
| Value | What happens |
|
|
47
|
-
|---|---|
|
|
48
|
-
| `checkout` | The money is taken as soon as the order is placed. This is the default. |
|
|
49
|
-
| `on_dispatch` | The amount is authorized at checkout and captured when the goods are dispatched. |
|
|
50
|
-
| `manual` | The amount is authorized at checkout and staff capture it when they choose. |
|
|
51
|
-
|
|
52
|
-
A payment method can override the store for its own payments by setting the same three values; leaving it blank inherits the store's choice. Ask a payment method what applies with `resolved_capture_method`, or use the `capture_at_checkout?`, `capture_on_dispatch?` and `capture_manually?` questions.
|
|
53
|
-
|
|
54
|
-
```ruby
|
|
55
|
-
payment_method.update!(capture_method: 'on_dispatch')
|
|
56
|
-
payment_method.resolved_capture_method # => "on_dispatch"
|
|
57
|
-
|
|
58
|
-
payment_method.update!(capture_method: nil) # back to inheriting
|
|
59
|
-
payment_method.resolved_capture_method # => "checkout"
|
|
60
|
-
```
|
|
61
|
-
|
|
62
|
-
If you're upgrading from an installation that used the older `auto_capture` and `auto_capture_on_dispatch` booleans, two tasks carry it over: `spree:store_settings:backfill_from_config` maps the old globals onto each store's `capture_method`, and `spree:migrate_capture_methods` converts the per-payment-method `auto_capture` column. A method left without a value inherits its store.
|
|
63
|
-
|
|
64
|
-
## Checkout and payments
|
|
65
|
-
|
|
66
|
-
| Setting | Default | What it does |
|
|
32
|
+
| Variable | Default | What it does |
|
|
67
33
|
|---|---|---|
|
|
68
|
-
| `
|
|
69
|
-
| `
|
|
34
|
+
| `SPREE_GUEST_CART_EXPIRY_DAYS` | `30` | How long an abandoned guest cart is kept before deletion. |
|
|
35
|
+
| `SPREE_CUSTOMER_CART_EXPIRY_DAYS` | `90` | How long a signed-in customer's abandoned cart is kept. |
|
|
36
|
+
| `SPREE_EMPTY_CART_EXPIRY_HOURS` | `48` | How long a cart with no items is kept. |
|
|
70
37
|
|
|
71
|
-
##
|
|
38
|
+
## Products and pricing
|
|
72
39
|
|
|
73
|
-
|
|
|
40
|
+
| Variable | Default | What it does |
|
|
74
41
|
|---|---|---|
|
|
75
|
-
| `
|
|
76
|
-
| `
|
|
77
|
-
| `empty_cart_expiry_hours` | `48` | How long a cart with no items is kept. |
|
|
42
|
+
| `SPREE_ALLOW_EMPTY_PRICE_AMOUNT` | `false` | Allows a price to be left blank instead of requiring an amount. Prices in a price list already allow blank. |
|
|
43
|
+
| `SPREE_ALWAYS_USE_TRANSLATIONS` | `false` | Always read product, category and collection names from the translation tables, even in the store's own default language. |
|
|
78
44
|
|
|
79
|
-
##
|
|
45
|
+
## Payments
|
|
80
46
|
|
|
81
|
-
|
|
|
47
|
+
| Variable | Default | What it does |
|
|
82
48
|
|---|---|---|
|
|
83
|
-
| `
|
|
84
|
-
| `price_history_retention_days` | `30` | How many days of price history the `spree:price_history:prune` task keeps. |
|
|
85
|
-
| `always_use_translations` | `false` | Always read product, category and collection names from the translation tables, even in the store's own default language. |
|
|
49
|
+
| `SPREE_CREDIT_TO_NEW_ALLOCATION` | `false` | Records refunded store credit as a new entry each time instead of topping the original credit back up. |
|
|
86
50
|
|
|
87
51
|
## Addresses
|
|
88
52
|
|
|
89
|
-
|
|
|
53
|
+
| Variable | Default | What it does |
|
|
90
54
|
|---|---|---|
|
|
91
|
-
| `
|
|
55
|
+
| `SPREE_GEOCODE_ADDRESSES` | `true` | Looks up latitude and longitude for saved addresses. |
|
|
92
56
|
|
|
93
|
-
##
|
|
57
|
+
## Uploads
|
|
94
58
|
|
|
95
|
-
|
|
|
59
|
+
| Variable | Default | What it does |
|
|
96
60
|
|---|---|---|
|
|
97
|
-
| `
|
|
98
|
-
| `
|
|
61
|
+
| `SPREE_MAX_IMAGE_DOWNLOAD_SIZE` | `20971520` | Largest file accepted when downloading an image from an external URL, in bytes (20 MB). |
|
|
62
|
+
| `SPREE_IMAGES_SAVE_FROM_URL_JOB_ATTEMPTS` | `5` | How many times to retry fetching an external image before giving up. |
|
|
63
|
+
| `SPREE_MAX_VIDEO_UPLOAD_SIZE` | `524288000` | Largest product video accepted, in bytes (500 MB). |
|
|
64
|
+
| `SPREE_MAX_SELLER_DOCUMENT_UPLOAD_SIZE` | `20971520` | Largest document a seller may upload for a requirement, in bytes (20 MB). Small on purpose — these are certificates and registrations. |
|
|
99
65
|
|
|
100
66
|
## Promotions and gift cards
|
|
101
67
|
|
|
102
|
-
|
|
|
68
|
+
| Variable | Default | What it does |
|
|
103
69
|
|---|---|---|
|
|
104
|
-
| `
|
|
105
|
-
| `
|
|
106
|
-
| `
|
|
107
|
-
| `
|
|
70
|
+
| `SPREE_COUPON_CODES_WEB_LIMIT` | `500` | How many coupon codes are created immediately when saving a promotion. Larger batches move to a background job so saving stays fast. |
|
|
71
|
+
| `SPREE_COUPON_CODES_TOTAL_LIMIT` | `5000` | Maximum coupon codes a single promotion may generate. |
|
|
72
|
+
| `SPREE_GIFT_CARD_BATCH_WEB_LIMIT` | `500` | How many gift card codes a batch creates immediately before switching to a background job. |
|
|
73
|
+
| `SPREE_GIFT_CARD_BATCH_LIMIT` | `50000` | Maximum gift card codes in a single batch. |
|
|
108
74
|
|
|
109
75
|
## Accounts and passwords
|
|
110
76
|
|
|
111
|
-
|
|
|
77
|
+
| Variable | Default | What it does |
|
|
112
78
|
|---|---|---|
|
|
113
|
-
| `
|
|
114
|
-
| `
|
|
115
|
-
| `
|
|
116
|
-
| `
|
|
117
|
-
| `
|
|
118
|
-
| `
|
|
119
|
-
|
|
120
|
-
## URLs
|
|
121
|
-
|
|
122
|
-
| Setting | Default | What it does |
|
|
123
|
-
|---|---|---|
|
|
124
|
-
| `dashboard_url` | `nil` | Where the React dashboard lives, so single sign-on can send staff back to it after they authenticate. |
|
|
125
|
-
| `admin_url` | `nil` | Base address used to build staff invitation links in email. Invitation links are relative when this is unset. |
|
|
79
|
+
| `SPREE_MINIMUM_PASSWORD_LENGTH` | `8` | Shortest password a customer or staff member may set. |
|
|
80
|
+
| `SPREE_MAXIMUM_PASSWORD_LENGTH` | `ActiveModel::SecurePassword::MAXPASSWORDLENGTHALLOWED` | Longest password allowed. |
|
|
81
|
+
| `SPREE_MAX_FAILED_LOGIN_ATTEMPTS` | `5` | Failed sign-ins before an account is temporarily locked. |
|
|
82
|
+
| `SPREE_LOCKOUT_DURATION` | `1800` | How long an account stays locked, in seconds. |
|
|
83
|
+
| `SPREE_CUSTOMER_PASSWORD_RESET_EXPIRES_IN` | `15` | How long a customer's password reset link stays valid, in minutes. |
|
|
84
|
+
| `SPREE_ADMIN_PASSWORD_RESET_EXPIRES_IN` | `15` | How long a staff password reset link stays valid, in minutes. |
|
|
126
85
|
|
|
127
86
|
## Imports and events
|
|
128
87
|
|
|
129
|
-
|
|
|
88
|
+
| Variable | Default | What it does |
|
|
130
89
|
|---|---|---|
|
|
131
|
-
| `
|
|
132
|
-
| `
|
|
133
|
-
| `
|
|
134
|
-
|
|
135
|
-
## API settings
|
|
90
|
+
| `SPREE_LARGE_IMPORT_THRESHOLD` | `500` | Row count above which a CSV import switches to bulk processing — faster, with less live progress detail. |
|
|
91
|
+
| `SPREE_EVENTS_LOG_ENABLED` | `true` | Writes every Spree event to the Rails log. |
|
|
92
|
+
| `SPREE_DISABLE_MIGRATION_CHECK` | `false` | Silences the boot warning about pending engine migrations. |
|
|
136
93
|
|
|
137
|
-
API
|
|
94
|
+
## API authentication
|
|
138
95
|
|
|
139
|
-
|
|
140
|
-
Spree::Api::Config.jwt_expiration = 1800
|
|
141
|
-
```
|
|
142
|
-
|
|
143
|
-
### Authentication
|
|
144
|
-
|
|
145
|
-
| Setting | Default | What it does |
|
|
96
|
+
| Variable | Default | What it does |
|
|
146
97
|
|---|---|---|
|
|
147
|
-
| `
|
|
148
|
-
| `
|
|
149
|
-
| `
|
|
150
|
-
| `
|
|
98
|
+
| `SPREE_JWT_EXPIRATION` | `3600` | How long a customer or store access token stays valid, in seconds. |
|
|
99
|
+
| `SPREE_ADMIN_JWT_EXPIRATION` | `300` | How long a staff access token stays valid. Deliberately short — staff tokens carry far more privilege. |
|
|
100
|
+
| `SPREE_REFRESH_TOKEN_EXPIRY` | `2592000` | How long a refresh token stays valid, in seconds (30 days). |
|
|
101
|
+
| `SPREE_JWT_SECRET_KEY` | — | Signing key for tokens. Falls back to `Rails.application.credentials.jwt_secret_key`, then the Rails secret key base. |
|
|
151
102
|
|
|
152
|
-
|
|
103
|
+
## API rate limits
|
|
153
104
|
|
|
154
|
-
|
|
|
105
|
+
| Variable | Default | What it does |
|
|
155
106
|
|---|---|---|
|
|
156
|
-
| `
|
|
157
|
-
| `
|
|
158
|
-
| `
|
|
159
|
-
| `
|
|
160
|
-
| `
|
|
161
|
-
| `
|
|
162
|
-
| `
|
|
163
|
-
| `
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
|
107
|
+
| `SPREE_RATE_LIMIT_WINDOW` | `60` | Length of the rate-limit window, in seconds. |
|
|
108
|
+
| `SPREE_RATE_LIMIT_PER_KEY` | `300` | Requests per window for each publishable key + client IP pair, and for keyless traffic per IP. Across the whole API, not per endpoint. |
|
|
109
|
+
| `SPREE_RATE_LIMIT_PER_SECRET_KEY` | `600` | Requests per secret API key per window, across the whole API. |
|
|
110
|
+
| `SPREE_RATE_LIMIT_LOGIN` | `5` | Sign-in attempts allowed per IP per window. |
|
|
111
|
+
| `SPREE_RATE_LIMIT_REGISTER` | `3` | Registration attempts per IP. |
|
|
112
|
+
| `SPREE_RATE_LIMIT_REFRESH` | `10` | Token refresh attempts per IP. |
|
|
113
|
+
| `SPREE_RATE_LIMIT_PASSWORD_RESET` | `3` | Password reset requests per IP. |
|
|
114
|
+
| `SPREE_MAX_REQUEST_BODY_SIZE` | `102400` | Largest accepted request body, in bytes (100 KB). |
|
|
115
|
+
|
|
116
|
+
## Webhooks
|
|
117
|
+
|
|
118
|
+
| Variable | Default | What it does |
|
|
168
119
|
|---|---|---|
|
|
169
|
-
| `
|
|
170
|
-
| `
|
|
171
|
-
|
|
172
|
-
## Reading a setting
|
|
173
|
-
|
|
174
|
-
```ruby
|
|
175
|
-
Spree::Config.minimum_password_length # => 8
|
|
176
|
-
Spree::Api::Config.jwt_expiration # => 3600
|
|
177
|
-
```
|
|
178
|
-
|
|
179
|
-
Assigning at runtime affects only the current process and is lost on restart. Set values in the initializer to make them stick.
|
|
180
|
-
|
|
181
|
-
## Deprecated settings
|
|
182
|
-
|
|
183
|
-
These still exist so upgrades don't break, but Spree either ignores them or reads them only from subsystems it has replaced. Don't use them in new code.
|
|
184
|
-
|
|
185
|
-
| Setting | Use instead |
|
|
186
|
-
|---|---|
|
|
187
|
-
| `return_eligibility_number_of_days` | The `return_window_days` preference on [Market](../core-concepts/markets.md), or a `returns.create.validate` [hook](workflows.md) |
|
|
188
|
-
| `restock_inventory` | Restocking is decided per return line item by its resellable flag — see [Returns](../core-concepts/returns-exchanges-claims.md#processing-a-return) |
|
|
189
|
-
| `expedited_exchanges` | [Exchanges](../core-concepts/returns-exchanges-claims.md) |
|
|
190
|
-
| `expedited_exchanges_days_window` | [Exchanges](../core-concepts/returns-exchanges-claims.md) |
|
|
191
|
-
| `enable_legacy_default_price` | Compatibility switch for the old default-price behavior; leave off |
|
|
192
|
-
| `use_user_locale` | Locale comes from the `x-spree-locale` header or the `locale` parameter |
|
|
193
|
-
| `company` | The `company_field_enabled` setting on the store |
|
|
194
|
-
| `address_requires_phone` | The `address_requires_phone` setting on the store |
|
|
195
|
-
| `default_stock_reservation_ttl_minutes` | The `stock_reservation_ttl_minutes` setting on the store |
|
|
196
|
-
| `auto_capture` | The `capture_method` setting on the store |
|
|
197
|
-
| `auto_capture_on_dispatch` | The `capture_method` setting on the store |
|
|
198
|
-
| `stock_reservations_enabled` | The `stock_reservations_enabled` setting on the store |
|
|
199
|
-
| `track_inventory_levels` | The `track_inventory_levels` setting on the store |
|
|
200
|
-
| `show_products_without_price` | The `show_products_without_price` setting on the store |
|
|
201
|
-
| `disable_sku_validation` | The `disable_sku_validation` setting on the store |
|
|
202
|
-
| `track_price_history` | The `track_price_history` setting on the store |
|
|
203
|
-
| `tax_using_ship_address` | The `tax_using_ship_address` setting on the store |
|
|
204
|
-
| `disable_store_presence_validation` | Every store-owned record now requires a store |
|
|
205
|
-
|
|
206
|
-
> **WARNING:** These settings have no effect at all, and are scheduled for removal: `allow_checkout_on_gateway_error` (completion checks whether payments cover the total, so a failed gateway call never completes an order), `products_per_page`, `alternative_shipping_phone`, `show_variant_full_price`, `reserve_stock_on`, `storefront_products_path`, `storefront_taxons_path`, `storefront_pages_path`. Setting them changes nothing.
|
|
207
|
-
|
|
208
|
-
## Settings that have been removed
|
|
209
|
-
|
|
210
|
-
These settings are gone. Assigning one in your initializer now raises `NoMethodError`, so delete the line.
|
|
211
|
-
|
|
212
|
-
| Setting | What to do instead |
|
|
213
|
-
|---|---|
|
|
214
|
-
| `send_core_emails` | The `send_consumer_transactional_emails` setting on the store, which turns a shop's customer emails on and off. |
|
|
215
|
-
| `currency` | Currency belongs to the store and the market. |
|
|
216
|
-
| `address_requires_state` | State requirements come from the address country. |
|
|
217
|
-
| `checkout_zone` | Use [delivery zones](../core-concepts/fulfillments.md#delivery-methods-and-zones). |
|
|
218
|
-
| `allow_guest_checkout` | Use the `guest_checkout` setting on the store or channel. |
|
|
219
|
-
| `binary_inventory_cache` | A stock change always touches its variant. |
|
|
220
|
-
| `logo`, `mailer_logo` | The store's own `logo` and `mailer_logo` images, uploaded in the dashboard. Only the global settings are gone; the images themselves are unchanged. |
|
|
221
|
-
| `layout`, `always_put_site_name_in_title`, `title_site_name_separator`, `max_level_in_taxons_menu`, `show_raw_product_description`, `shipping_instructions`, `show_only_complete_orders_by_default` | These configured the removed Rails storefront and admin. A storefront owns its own presentation. |
|
|
120
|
+
| `SPREE_WEBHOOKS_ENABLED` | `true` | Whether webhooks fire at all. |
|
|
121
|
+
| `SPREE_WEBHOOKS_VERIFY_SSL` | `true` | Verifies SSL certificates on webhook endpoints. Off in development. |
|
|
222
122
|
|
|
223
123
|
## Related
|
|
224
124
|
|
|
125
|
+
- [Stores](../core-concepts/stores.md) — the settings a shop owns
|
|
225
126
|
- [Model preferences](model-preferences.md) — per-record settings
|
|
226
127
|
- [Services & Workflows](workflows.md) — changing behavior rather than settings
|