@spree/docs 0.1.240 → 0.1.242

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 (28) hide show
  1. package/dist/api-reference/store-api/metadata.md +6 -6
  2. package/dist/developer/core-concepts/architecture.md +15 -19
  3. package/dist/developer/core-concepts/carts.md +71 -1
  4. package/dist/developer/core-concepts/delivery-setup.md +3 -1
  5. package/dist/developer/core-concepts/freight.md +279 -0
  6. package/dist/developer/core-concepts/metafields.md +0 -2
  7. package/dist/developer/core-concepts/payments.md +123 -72
  8. package/dist/developer/core-concepts/sellers.md +50 -5
  9. package/dist/developer/create-spree-app/quickstart.md +22 -19
  10. package/dist/developer/customization/api.md +2 -2
  11. package/dist/developer/customization/checkout.md +117 -0
  12. package/dist/developer/customization/configuration.md +76 -175
  13. package/dist/developer/customization/decorators.md +120 -130
  14. package/dist/developer/customization/metadata.md +9 -9
  15. package/dist/developer/customization/model-preferences.md +34 -68
  16. package/dist/developer/customization/permissions.md +13 -28
  17. package/dist/developer/customization/validations.md +16 -43
  18. package/dist/developer/getting-started/quickstart.md +25 -24
  19. package/dist/developer/how-to/custom-promotion.md +1 -1
  20. package/dist/developer/how-to/custom-search-provider.md +2 -2
  21. package/dist/developer/how-to/custom-stock-splitter.md +2 -2
  22. package/dist/developer/sdk/admin/extending.md +1 -1
  23. package/dist/developer/sdk/admin/quickstart.md +1 -1
  24. package/dist/developer/sdk/admin/resources.md +1 -1
  25. package/dist/developer/sdk/configuration.md +1 -1
  26. package/dist/developer/sdk/extending.md +1 -1
  27. package/dist/developer/tutorial/testing.md +45 -91
  28. package/package.json +1 -1
@@ -0,0 +1,117 @@
1
+ ---
2
+ title: Customizing Checkout
3
+ description: Add your own checkout step or requirement, and reorder or remove the built-in ones.
4
+ ---
5
+
6
+ Spree does not run your checkout — your storefront does. What Spree owns is the list
7
+ of things a cart still needs, which it reports on cart reads and enforces when you
8
+ complete one. Adding to that list is how you make checkout require something of your
9
+ own.
10
+
11
+ > **NOTE:** For what a cart reports and how to read it, see
12
+ > [Carts](../core-concepts/carts.md#checkout-requirements). This page is about
13
+ > adding to it.
14
+
15
+ ## Requirements are the gate, steps are a label
16
+
17
+ Two things are easy to confuse:
18
+
19
+ - A **requirement** is enforced. It appears on cart reads while unmet, and completing
20
+ a cart recomputes the list and refuses if anything is outstanding.
21
+ - A **step** is descriptive. It exists so a storefront can render a progress
22
+ indicator. Nothing on the server checks which step a customer is on.
23
+
24
+ So a requirement is what you reach for when something must be true before an order
25
+ exists. A step is only worth adding when your checkout genuinely has a stage the
26
+ built-in five don't describe.
27
+
28
+ ## Adding a requirement
29
+
30
+ When the flow is unchanged and you only need one more condition:
31
+
32
+ ```ruby server/config/initializers/spree.rb
33
+ Spree::Checkout::Registry.add_requirement(
34
+ step: :address,
35
+ field: :vat_number,
36
+ message: 'VAT number is required for business orders',
37
+ satisfied: ->(cart) { cart.custom_fields['vat_number'].present? }
38
+ )
39
+ ```
40
+
41
+ While `satisfied:` returns false the cart reports the requirement and refuses to
42
+ complete. Its `code` is derived as `<field>_required` — `vat_number_required` here.
43
+
44
+ Pass `applicable:` to scope it. It is checked before `satisfied:`, so a requirement
45
+ that doesn't apply never appears at all:
46
+
47
+ ```ruby
48
+ applicable: ->(cart) { cart.customer&.company.present? }
49
+ ```
50
+
51
+ `message` is stored verbatim — wrap it in `Spree.t` yourself if it needs translating.
52
+
53
+ ## Adding a step
54
+
55
+ A step bundles its own requirements and says when it is satisfied:
56
+
57
+ ```ruby server/config/initializers/spree.rb
58
+ Spree::Checkout::Registry.register_step(
59
+ name: :loyalty,
60
+ before: :payment,
61
+ satisfied: ->(cart) { cart.custom_fields['loyalty_number'].present? },
62
+ requirements: ->(cart) {
63
+ [{ step: 'loyalty', field: 'loyalty_number',
64
+ message: 'Loyalty number is required' }]
65
+ }
66
+ )
67
+ ```
68
+
69
+ The step now shows up in the cart's `current_step` and `completed_steps`, its
70
+ requirements appear in `requirements` while unsatisfied, and completion refuses the
71
+ cart until they are met.
72
+
73
+ Each lambda receives the cart. Placement is controlled by two keywords:
74
+
75
+ | Keyword | Effect |
76
+ |---|---|
77
+ | `before:` / `after:` | Place the step next to an existing one. `before:` wins if both are given |
78
+ | `applicable:` | Whether the step exists for this cart at all — checked before `satisfied:` |
79
+
80
+ An unanchored step lands immediately before `complete`. An anchor naming a step this
81
+ particular cart doesn't have — `before: :payment` on a free cart — falls back to the
82
+ same place.
83
+
84
+ Unlike an added requirement, a step's `requirements:` lambda may set its own `code:`.
85
+
86
+ ## Reordering or removing built-in steps
87
+
88
+ ```ruby server/config/initializers/spree.rb
89
+ # Drop a step from the reported list
90
+ Spree::Checkout::Registry.base_steps.delete('confirm')
91
+
92
+ # Or change when one applies
93
+ Spree::Checkout::Registry.base_steps['payment'] = ->(cart) { cart.total > 0 }
94
+
95
+ # Or reorder wholesale — known names keep their own applicability
96
+ Spree::Checkout::Registry.base_step_names = %w[address payment delivery complete]
97
+ ```
98
+
99
+ > **WARNING:** Removing a step removes it from the reported list. It does **not** remove the
100
+ > requirements filed under it — dropping `payment` does not let an unpaid cart
101
+ > complete. Requirements and steps are separate on purpose.
102
+
103
+ ## Prefer a requirement to a workflow hook
104
+
105
+ A [workflow hook](workflows.md) on `carts.complete.validate`
106
+ can also reject a cart, and there are cases for it — anything needing a network call, or a
107
+ decision that only makes sense at the moment of completion.
108
+
109
+ For anything a customer has to fix, a requirement is better: it is reported on every
110
+ cart read, so the storefront can show it while they can still act, rather than failing
111
+ at the last step with an error they have to interpret.
112
+
113
+ ## Related
114
+
115
+ - [Carts](../core-concepts/carts.md) — reading requirements and completing a cart
116
+ - [Custom fields](../core-concepts/metafields.md) — storing your own data on a cart
117
+ - [Services & Workflows](workflows.md) — hooks that run during completion
@@ -1,226 +1,127 @@
1
1
  ---
2
2
  title: Configuration
3
- description: Every global Spree setting that is actually read by Spree — grouped by area, with defaults and what each one changes.
3
+ description: Every Spree setting, the environment variable that sets it, and what it changes.
4
4
  ---
5
5
 
6
- Global settings live in `config/initializers/spree.rb` and apply to the whole application. Anything that varies per store — currency, markets, delivery zones, languages — is data you change in the dashboard instead.
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
- ```ruby config/initializers/spree.rb
9
- Spree.config do |config|
10
- config.minimum_password_length = 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
- > **NOTE:** Restart your Rails server after editing the initializer.
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
- ## Deployment settings read the environment
20
+ > **NOTE:** Booleans accept `true`/`false`, `1`/`0`, `yes`/`no` and `on`/`off`, in any case.
18
21
 
19
- Settings that describe the deployment rather than commerce behavior can be set with an environment variable — no Ruby, no code change, no restart-after-edit dance. An explicitly configured value always wins over the environment.
22
+ ## Hosting
20
23
 
21
- | Setting | Environment variable | What it configures |
24
+ | Variable | Default | What it does |
22
25
  |---|---|---|
23
- | `dashboard_url` | `SPREE_DASHBOARD_URL` | Origin where the admin dashboard is hosted (e.g. `https://admin.my-shop.com`). Used for every link that sends someone into the dashboard: invitation emails, SSO redirects, and the first-run setup link printed by `db:seed`. |
24
- | `seller_panel_url` | `SPREE_SELLER_PANEL_URL` | Origin where the marketplace seller panel is hosted, when you serve it somewhere other than this app's own `/sellers` mount. Used for links sent to sellers, today the invitation email. Leave it unset to use `/sellers`; with no panel deployed at all, those links open the dashboard. |
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
- This page lists only settings Spree actually reads. Settings that exist for backwards compatibility are listed under [Deprecated settings](#deprecated-settings) rather than mixed in with the rest.
30
+ ## Carts
27
31
 
28
- ## Settings that belong to a store
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
- | `always_include_confirm_step` | `false` | Always shows a confirmation step, even when the payment method doesn't need one. |
69
- | `credit_to_new_allocation` | `false` | Records refunded store credit as a new entry each time instead of topping the original credit back up. |
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
- ## Carts and stock reservations
38
+ ## Products and pricing
72
39
 
73
- | Setting | Default | What it does |
40
+ | Variable | Default | What it does |
74
41
  |---|---|---|
75
- | `guest_cart_expiry_days` | `30` | How long an abandoned guest cart is kept before deletion. |
76
- | `customer_cart_expiry_days` | `90` | How long a signed-in customer's abandoned cart is kept. |
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
- ## Products and pricing
45
+ ## Payments
80
46
 
81
- | Setting | Default | What it does |
47
+ | Variable | Default | What it does |
82
48
  |---|---|---|
83
- | `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. |
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
- | Setting | Default | What it does |
53
+ | Variable | Default | What it does |
90
54
  |---|---|---|
91
- | `geocode_addresses` | `true` | Looks up latitude and longitude for saved addresses. |
55
+ | `SPREE_GEOCODE_ADDRESSES` | `true` | Looks up latitude and longitude for saved addresses. |
92
56
 
93
- ## Media
57
+ ## Uploads
94
58
 
95
- | Setting | Default | What it does |
59
+ | Variable | Default | What it does |
96
60
  |---|---|---|
97
- | `max_image_download_size` | `20971520` | Largest file size, in bytes, accepted when downloading an image from an external URL. |
98
- | `images_save_from_url_job_attempts` | `5` | How many times to retry fetching an external image before giving up. |
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
- | Setting | Default | What it does |
68
+ | Variable | Default | What it does |
103
69
  |---|---|---|
104
- | `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. |
105
- | `coupon_codes_total_limit` | `5000` | Maximum coupon codes a single promotion may generate. |
106
- | `gift_card_batch_web_limit` | `500` | How many gift card codes a batch creates immediately before switching to a background job. |
107
- | `gift_card_batch_limit` | `50000` | Maximum gift card codes in a single batch. |
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
- | Setting | Default | What it does |
77
+ | Variable | Default | What it does |
112
78
  |---|---|---|
113
- | `minimum_password_length` | `8` | Shortest password a customer or staff member may set. |
114
- | `maximum_password_length` | `72` | Longest password allowed. |
115
- | `max_failed_login_attempts` | `5` | Failed sign-ins before an account is temporarily locked. |
116
- | `lockout_duration` | `1800` | How long an account stays locked, in seconds. |
117
- | `customer_password_reset_expires_in` | `15` | How long a customer's password reset link stays valid, in minutes. |
118
- | `admin_password_reset_expires_in` | `15` | How long a staff password reset link stays valid, in minutes. |
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
- | Setting | Default | What it does |
88
+ | Variable | Default | What it does |
130
89
  |---|---|---|
131
- | `large_import_threshold` | `500` | Row count above which a CSV import switches to bulk processing — faster, with less live progress detail. |
132
- | `events_log_enabled` | `true` | Writes every Spree event to the Rails log. |
133
- | `disable_migration_check` | `false` | Silences the boot warning about pending engine migrations. |
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 settings live on their own configuration object:
94
+ ## API authentication
138
95
 
139
- ```ruby config/initializers/spree.rb
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
- | `jwt_expiration` | `3600` | How long a customer or store access token stays valid, in seconds. |
148
- | `admin_jwt_expiration` | `300` | How long a staff access token stays valid. Deliberately short — admin tokens carry far more privilege. |
149
- | `refresh_token_expiry` | `2592000` | How long a refresh token stays valid, in seconds (30 days). |
150
- | `jwt_secret_key` | `nil` | Signing key for tokens. Falls back to the Rails secret key base. |
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
- ### Rate limits
103
+ ## API rate limits
153
104
 
154
- | Setting | Default | What it does |
105
+ | Variable | Default | What it does |
155
106
  |---|---|---|
156
- | `rate_limit_window` | `60` | Length of the rate-limit window, in seconds. |
157
- | `rate_limit_per_key` | `300` | Requests allowed per window for each publishable API key + client IP pair (per visitor), and for keyless traffic per IP. Applies across the whole API, not per endpoint. |
158
- | `rate_limit_per_secret_key` | `600` | Requests allowed per secret API key per window, across the whole API. |
159
- | `rate_limit_login` | `5` | Sign-in attempts allowed per IP per window. |
160
- | `rate_limit_register` | `3` | Registration attempts per IP. |
161
- | `rate_limit_refresh` | `10` | Token refresh attempts per IP. |
162
- | `rate_limit_password_reset` | `3` | Password reset requests per IP. |
163
- | `max_request_body_size` | `102400` | Largest accepted request body, in bytes (100 KB). |
164
-
165
- ### Webhooks
166
-
167
- | Setting | Default | What it does |
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
- | `webhooks_enabled` | `true` | Whether webhooks fire at all. |
170
- | `webhooks_verify_ssl` | `true` | Verifies SSL certificates on webhook endpoints. Off in development. |
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