@spree/docs 0.1.0
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/README.md +54 -0
- package/dist/api-reference/platform/authentication.md +38 -0
- package/dist/api-reference/store-api/authentication.md +188 -0
- package/dist/api-reference/store-api/errors.md +277 -0
- package/dist/api-reference/store-api/idempotency.md +129 -0
- package/dist/api-reference/store-api/introduction.md +34 -0
- package/dist/api-reference/store-api/localization.md +279 -0
- package/dist/api-reference/store-api/metadata.md +160 -0
- package/dist/api-reference/store-api/monetary-amounts.md +65 -0
- package/dist/api-reference/store-api/querying.md +399 -0
- package/dist/api-reference/store-api/rate-limitting.md +103 -0
- package/dist/api-reference/store-api/relations.md +185 -0
- package/dist/api-reference/storefront/authentication.md +88 -0
- package/dist/api-reference/tutorials/adyen-integration-guide-for-android.md +165 -0
- package/dist/api-reference/tutorials/adyen-integration-guide-for-ios.md +194 -0
- package/dist/api-reference/tutorials/quick-checkout-with-stripe.md +248 -0
- package/dist/api-reference/v2/fetching-multiple-resources.md +26 -0
- package/dist/api-reference/v2/filtering-and-sorting.md +53 -0
- package/dist/api-reference/v2/introduction.md +22 -0
- package/dist/api-reference/v2/pagination.md +37 -0
- package/dist/api-reference/webhooks-events.md +883 -0
- package/dist/developer/admin/admin.md +205 -0
- package/dist/developer/admin/authentication.md +59 -0
- package/dist/developer/admin/components.md +711 -0
- package/dist/developer/admin/custom-css.md +243 -0
- package/dist/developer/admin/custom-javascript.md +116 -0
- package/dist/developer/admin/extending-ui.md +1964 -0
- package/dist/developer/admin/form-builder.md +444 -0
- package/dist/developer/admin/helper-methods.md +531 -0
- package/dist/developer/admin/navigation.md +805 -0
- package/dist/developer/admin/tables.md +491 -0
- package/dist/developer/advanced/adding_spree_to_rails_app.md +106 -0
- package/dist/developer/cli/quickstart.md +137 -0
- package/dist/developer/contributing/creating-an-extension.md +258 -0
- package/dist/developer/contributing/developing-spree.md +339 -0
- package/dist/developer/contributing/quickstart.md +32 -0
- package/dist/developer/contributing/updating-extensions.md +67 -0
- package/dist/developer/core-concepts/addresses.md +265 -0
- package/dist/developer/core-concepts/adjustments.md +107 -0
- package/dist/developer/core-concepts/architecture.md +177 -0
- package/dist/developer/core-concepts/calculators.md +323 -0
- package/dist/developer/core-concepts/customers.md +230 -0
- package/dist/developer/core-concepts/events.md +624 -0
- package/dist/developer/core-concepts/imports-exports.md +698 -0
- package/dist/developer/core-concepts/inventory.md +191 -0
- package/dist/developer/core-concepts/markets.md +250 -0
- package/dist/developer/core-concepts/media.md +167 -0
- package/dist/developer/core-concepts/metafields.md +187 -0
- package/dist/developer/core-concepts/orders.md +328 -0
- package/dist/developer/core-concepts/payments.md +710 -0
- package/dist/developer/core-concepts/pricing.md +163 -0
- package/dist/developer/core-concepts/products.md +360 -0
- package/dist/developer/core-concepts/promotions.md +322 -0
- package/dist/developer/core-concepts/reports.md +206 -0
- package/dist/developer/core-concepts/search-filtering.md +237 -0
- package/dist/developer/core-concepts/shipments.md +212 -0
- package/dist/developer/core-concepts/slugs.md +111 -0
- package/dist/developer/core-concepts/staff-roles.md +123 -0
- package/dist/developer/core-concepts/store-credits-gift-cards.md +317 -0
- package/dist/developer/core-concepts/stores.md +117 -0
- package/dist/developer/core-concepts/taxes.md +135 -0
- package/dist/developer/core-concepts/translations.md +120 -0
- package/dist/developer/core-concepts/users.md +299 -0
- package/dist/developer/core-concepts/webhooks.md +378 -0
- package/dist/developer/create-spree-app/quickstart.md +158 -0
- package/dist/developer/customization/api.md +93 -0
- package/dist/developer/customization/authentication.md +88 -0
- package/dist/developer/customization/checkout.md +204 -0
- package/dist/developer/customization/configuration.md +55 -0
- package/dist/developer/customization/decorators.md +523 -0
- package/dist/developer/customization/dependencies.md +232 -0
- package/dist/developer/customization/emails.md +21 -0
- package/dist/developer/customization/extensions.md +92 -0
- package/dist/developer/customization/metadata.md +236 -0
- package/dist/developer/customization/model-preferences.md +130 -0
- package/dist/developer/customization/permissions.md +265 -0
- package/dist/developer/customization/quickstart.md +229 -0
- package/dist/developer/customization/routes.md +24 -0
- package/dist/developer/customization/v4/admin-panel.md +78 -0
- package/dist/developer/customization/v4/authentication.md +210 -0
- package/dist/developer/customization/v4/checkout.md +212 -0
- package/dist/developer/customization/v4/deface.md +251 -0
- package/dist/developer/customization/v4/images.md +86 -0
- package/dist/developer/customization/v4/storefront.md +450 -0
- package/dist/developer/deployment/assets.md +87 -0
- package/dist/developer/deployment/aws.md +335 -0
- package/dist/developer/deployment/caching.md +27 -0
- package/dist/developer/deployment/cdn.md +39 -0
- package/dist/developer/deployment/database.md +155 -0
- package/dist/developer/deployment/docker.md +128 -0
- package/dist/developer/deployment/emails.md +77 -0
- package/dist/developer/deployment/environment_variables.md +111 -0
- package/dist/developer/deployment/heroku.md +51 -0
- package/dist/developer/deployment/render.md +95 -0
- package/dist/developer/getting-started/quickstart.md +82 -0
- package/dist/developer/how-to/custom-payment-method.md +374 -0
- package/dist/developer/how-to/custom-promotion.md +373 -0
- package/dist/developer/how-to/custom-report.md +387 -0
- package/dist/developer/how-to/custom-search-provider.md +230 -0
- package/dist/developer/multi-store/quickstart.md +71 -0
- package/dist/developer/multi-store/setup.md +38 -0
- package/dist/developer/multi-tenant/configuration.md +41 -0
- package/dist/developer/multi-tenant/core-concepts.md +75 -0
- package/dist/developer/multi-tenant/installation.md +96 -0
- package/dist/developer/multi-tenant/quickstart.md +20 -0
- package/dist/developer/multi-vendor/installation.md +45 -0
- package/dist/developer/multi-vendor/quickstart.md +17 -0
- package/dist/developer/sdk/admin/quickstart.md +22 -0
- package/dist/developer/sdk/authentication.md +89 -0
- package/dist/developer/sdk/configuration.md +225 -0
- package/dist/developer/sdk/quickstart.md +82 -0
- package/dist/developer/sdk/store/account.md +67 -0
- package/dist/developer/sdk/store/cart-checkout.md +140 -0
- package/dist/developer/sdk/store/markets.md +151 -0
- package/dist/developer/sdk/store/payments.md +96 -0
- package/dist/developer/sdk/store/products.md +149 -0
- package/dist/developer/sdk/store/wishlists.md +52 -0
- package/dist/developer/security/pci_compliance.md +15 -0
- package/dist/developer/security/security_policy.md +68 -0
- package/dist/developer/storefront/blocks.md +285 -0
- package/dist/developer/storefront/custom-css.md +260 -0
- package/dist/developer/storefront/custom-javascript.md +166 -0
- package/dist/developer/storefront/helper-methods.md +1288 -0
- package/dist/developer/storefront/links.md +298 -0
- package/dist/developer/storefront/nextjs/architecture.md +150 -0
- package/dist/developer/storefront/nextjs/customization.md +141 -0
- package/dist/developer/storefront/nextjs/deployment.md +180 -0
- package/dist/developer/storefront/nextjs/quickstart.md +92 -0
- package/dist/developer/storefront/nextjs/spree-next-package.md +314 -0
- package/dist/developer/storefront/pages.md +163 -0
- package/dist/developer/storefront/sections.md +569 -0
- package/dist/developer/storefront/storefront.md +56 -0
- package/dist/developer/storefront/themes.md +161 -0
- package/dist/developer/tutorial/admin.md +134 -0
- package/dist/developer/tutorial/extending-models.md +380 -0
- package/dist/developer/tutorial/file-uploads.md +121 -0
- package/dist/developer/tutorial/introduction.md +33 -0
- package/dist/developer/tutorial/model.md +41 -0
- package/dist/developer/tutorial/page-builder.md +487 -0
- package/dist/developer/tutorial/rich-text.md +73 -0
- package/dist/developer/tutorial/seo.md +332 -0
- package/dist/developer/tutorial/storefront.md +352 -0
- package/dist/developer/tutorial/testing.md +558 -0
- package/dist/developer/upgrades/2.0-to-2.1.md +46 -0
- package/dist/developer/upgrades/2.1-to-2.2.md +59 -0
- package/dist/developer/upgrades/2.2-to-2.3.md +44 -0
- package/dist/developer/upgrades/2.3-to-2.4.md +42 -0
- package/dist/developer/upgrades/3.0-to-3.1.md +47 -0
- package/dist/developer/upgrades/3.1-to-3.2.md +34 -0
- package/dist/developer/upgrades/3.2-to-3.3.md +70 -0
- package/dist/developer/upgrades/3.3-to-3.4.md +36 -0
- package/dist/developer/upgrades/3.4-to-3.5.md +44 -0
- package/dist/developer/upgrades/3.5-to-3.6.md +40 -0
- package/dist/developer/upgrades/3.6-to-3.7.md +62 -0
- package/dist/developer/upgrades/3.7-to-4.0.md +152 -0
- package/dist/developer/upgrades/4.0-to-4.1.md +92 -0
- package/dist/developer/upgrades/4.1-to-4.2.md +109 -0
- package/dist/developer/upgrades/4.10-to-5.0.md +129 -0
- package/dist/developer/upgrades/4.2-to-4.3.md +100 -0
- package/dist/developer/upgrades/4.3-to-4.4.md +125 -0
- package/dist/developer/upgrades/4.4-to-4.5.md +94 -0
- package/dist/developer/upgrades/4.5-to-4.6.md +119 -0
- package/dist/developer/upgrades/4.6-to-4.7.md +39 -0
- package/dist/developer/upgrades/4.8-to-4.9.md +24 -0
- package/dist/developer/upgrades/4.9-to-4.10.md +24 -0
- package/dist/developer/upgrades/4.x-to-4.8.md +52 -0
- package/dist/developer/upgrades/5.0-to-5.1.md +28 -0
- package/dist/developer/upgrades/5.1-to-5.2.md +127 -0
- package/dist/developer/upgrades/5.2-to-5.3.md +338 -0
- package/dist/developer/upgrades/5.3-to-5.4.md +248 -0
- package/dist/developer/upgrades/quickstart.md +36 -0
- package/dist/integrations/analytics/google-analytics.md +64 -0
- package/dist/integrations/analytics/google-tag-manager.md +78 -0
- package/dist/integrations/integrations.md +39 -0
- package/dist/integrations/marketing/klaviyo.md +99 -0
- package/dist/integrations/payments/adyen.md +90 -0
- package/dist/integrations/payments/paypal.md +41 -0
- package/dist/integrations/payments/razorpay.md +45 -0
- package/dist/integrations/payments/stripe.md +109 -0
- package/dist/integrations/search/meilisearch.md +236 -0
- package/dist/integrations/sso-mfa-social-login/admin-dashboard.md +57 -0
- package/dist/integrations/sso-mfa-social-login/storefront.md +56 -0
- package/package.json +27 -0
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: 4.6 to 4.7
|
|
3
|
+
description: This guide covers upgrading a 4.6 Spree application to Spree 4.7.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
> **WARNING:** We recommend [upgrading straight to 4.8](4.x-to-4.8), as we improved how we handle translations in 4.8.
|
|
7
|
+
> This also means easier database migration, especially if you have a big product catalog.
|
|
8
|
+
|
|
9
|
+
> **NOTE:** If you're on an older version than 4.6 please follow previous upgrade guides and perform those upgrades incrementally
|
|
10
|
+
>
|
|
11
|
+
> 1. [upgrade 4.3 to 4.4](4.3-to-4.4)
|
|
12
|
+
> 2. [upgrade 4.4 to 4.5](4.4-to-4.5)
|
|
13
|
+
> 3. [upgrade 4.5 to 4.6](4.5-to-4.6)
|
|
14
|
+
|
|
15
|
+
## Upgrade steps
|
|
16
|
+
|
|
17
|
+
### 1. Update gems
|
|
18
|
+
|
|
19
|
+
```bash
|
|
20
|
+
bundle update
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
### 2. Install and run missing migrations
|
|
24
|
+
|
|
25
|
+
```bash
|
|
26
|
+
bin/rake spree:install:migrations && bin/rails db:migrate
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
### 3. (Optional) Re-Run Spree Frontend install
|
|
30
|
+
|
|
31
|
+
If you're using [Spree Frontend gem](https://github.com/spree/spree_rails_frontend), run the following additional commands to get everything set up correctly with the updated gems:
|
|
32
|
+
|
|
33
|
+
```bash
|
|
34
|
+
bin/rails g spree:frontend:install
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
## Read the release notes
|
|
38
|
+
|
|
39
|
+
For information about changes contained within this release, please read the [Spree 4.7.0 Release Notes.](https://github.com/spree/spree/releases/tag/v4.7.0)
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: Upgrading to Spree 4.9
|
|
3
|
+
description: This guide covers upgrading a Spree 4.8 application to Spree 4.9.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
> **INFO:** Before proceeding to upgrade, please ensure you're at [Spree 4.8](/developer/upgrades/4.x-to-4.8)
|
|
7
|
+
|
|
8
|
+
## Upgrade steps
|
|
9
|
+
|
|
10
|
+
### 1. Update gems
|
|
11
|
+
|
|
12
|
+
```bash
|
|
13
|
+
bundle update
|
|
14
|
+
```
|
|
15
|
+
|
|
16
|
+
### 2. Install and run missing migrations
|
|
17
|
+
|
|
18
|
+
```bash
|
|
19
|
+
bin/rake spree:install:migrations && bin/rails db:migrate
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
## Read the release notes
|
|
23
|
+
|
|
24
|
+
For information about changes contained within this release, please read the [Spree 4.9.0 Release Notes.](https://github.com/orgs/spree/discussions/12123)
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: Upgrading to Spree 4.10
|
|
3
|
+
description: This guide covers upgrading a Spree 4.9 application to Spree 4.10.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
> **INFO:** Before proceeding to upgrade, please ensure you're at [Spree 4.9](/developer/upgrades/4.8-to-4.9)
|
|
7
|
+
|
|
8
|
+
## Upgrade steps
|
|
9
|
+
|
|
10
|
+
### 1. Update gems
|
|
11
|
+
|
|
12
|
+
```bash
|
|
13
|
+
bundle update
|
|
14
|
+
```
|
|
15
|
+
|
|
16
|
+
### 2. Install and run missing migrations
|
|
17
|
+
|
|
18
|
+
```bash
|
|
19
|
+
bin/rake spree:install:migrations && bin/rails db:migrate
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
## Read the release notes
|
|
23
|
+
|
|
24
|
+
For information about changes contained within this release, please read the [Spree 4.10.0 Release Notes.](https://github.com/orgs/spree/discussions/12154)
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: Upgrading to Spree 4.8
|
|
3
|
+
description: This guide covers upgrading a Spree 4 application to Spree 4.8.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
> **INFO:** Before proceeding to upgrade, please ensure you're at Spree 4.4 or later and Rails 6.1 or later.
|
|
7
|
+
|
|
8
|
+
## Upgrade steps
|
|
9
|
+
|
|
10
|
+
### 1. Update gems
|
|
11
|
+
|
|
12
|
+
```bash
|
|
13
|
+
bundle update
|
|
14
|
+
```
|
|
15
|
+
|
|
16
|
+
### 2. Install and run missing migrations
|
|
17
|
+
|
|
18
|
+
```bash
|
|
19
|
+
bin/rake spree:install:migrations && bin/rails db:migrate
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
### 3. (Optional) Install importmap-rails gem
|
|
23
|
+
|
|
24
|
+
We've switched to using [importmap-rails](https://github.com/rails/importmap-rails) for asset management. If you're using the `spree_backend` or `spree_frontend` gem, you'll need to install the `importmap-rails` gem.
|
|
25
|
+
|
|
26
|
+
```bash
|
|
27
|
+
bundle add importmap-rails
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
and run generators:
|
|
31
|
+
|
|
32
|
+
```bash
|
|
33
|
+
bin/rails importmap:install && bin/rails turbo:install && bin/rails stimulus:install
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
You can also remove the `jsbundling-rails` gem from your `Gemfile`:
|
|
37
|
+
|
|
38
|
+
```bash
|
|
39
|
+
bundle remove jsbundling-rails
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
### 4. (Optional) Apply fix when upgrading from 4.5/4.6/4.7
|
|
43
|
+
|
|
44
|
+
If you're upgrading from 4.5/4.6/4.7, you need to set this configuration in your `config/initializers/spree.rb`:
|
|
45
|
+
|
|
46
|
+
```ruby
|
|
47
|
+
Spree::RuntimeConfig.always_use_translations = true
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
## Read the release notes
|
|
51
|
+
|
|
52
|
+
For information about changes contained within this release, please read the [Spree 4.8.0 Release Notes.](https://github.com/spree/spree/releases/tag/v4.8.0)
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: Upgrading to Spree 5.1
|
|
3
|
+
description: This guide covers upgrading a Spree 5.0 application to Spree 5.1.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
> **INFO:** Before proceeding to upgrade, please ensure you're at [Spree 5.0](/developer/upgrades/4.10-to-5.0)
|
|
7
|
+
|
|
8
|
+
## Upgrade steps
|
|
9
|
+
|
|
10
|
+
### 1. Update gems
|
|
11
|
+
|
|
12
|
+
```bash
|
|
13
|
+
bundle update
|
|
14
|
+
```
|
|
15
|
+
|
|
16
|
+
### 2. Install and run missing migrations
|
|
17
|
+
|
|
18
|
+
```bash
|
|
19
|
+
bin/rake spree:install:migrations && bin/rails db:migrate
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
### 3. Migrate admin user accounts to the new system
|
|
23
|
+
|
|
24
|
+
Spree 5.1 introduces a new better way of managing admin user accounts. To ensure your existing admin user accounts are migrated to the new system, run the following command:
|
|
25
|
+
|
|
26
|
+
```bash
|
|
27
|
+
bin/rake db:migrate_admin_users_to_role_users
|
|
28
|
+
```
|
|
@@ -0,0 +1,127 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: Upgrading to Spree 5.2
|
|
3
|
+
description: This guide covers upgrading a Spree 5.1 application to Spree 5.2.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
> **INFO:** Before proceeding to upgrade, please ensure you're at [Spree 5.1](/developer/upgrades/5.0-to-5.1)
|
|
7
|
+
|
|
8
|
+
## Upgrade steps
|
|
9
|
+
|
|
10
|
+
### Update gems
|
|
11
|
+
|
|
12
|
+
```bash
|
|
13
|
+
bundle update
|
|
14
|
+
```
|
|
15
|
+
|
|
16
|
+
### Install `propshaft` gem
|
|
17
|
+
|
|
18
|
+
Spree 5.2 does not rely on `sprockets` gem anymore. You can either add `sprockets` to your `Gemfile` or move to `propshaft` gem (recommended).
|
|
19
|
+
|
|
20
|
+
Propshaft is the new default asset pipeline for Rails 7+ applications. It's more performant and has better support for modern browsers.
|
|
21
|
+
|
|
22
|
+
Please run the following command to install `propshaft` gem:
|
|
23
|
+
|
|
24
|
+
```bash
|
|
25
|
+
bundle add propshaft
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
### Install and run missing migrations
|
|
29
|
+
|
|
30
|
+
```bash
|
|
31
|
+
bin/rake spree:install:migrations && bin/rails db:migrate
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
### Migrate to Metafields or keep using Product Properties
|
|
35
|
+
|
|
36
|
+
Spree 5.2 introduces [Metafields](/developer/core-concepts/metafields), which are a new way to store additional information about an object. Previously, we used Product Properties to enrich products. Metafields are more powerful, more flexible and can be attached to any object not just products.
|
|
37
|
+
|
|
38
|
+
However we now that properties were available in Spree since it's beginning. So we decided to keep them for backward compatibility until Spree 6.0 to give you time to migrate to metafields.
|
|
39
|
+
|
|
40
|
+
To keep using Product Properties, you will need to set a configuration flag in your `config/initializers/spree.rb` file:
|
|
41
|
+
|
|
42
|
+
```bash
|
|
43
|
+
Spree.config do |config|
|
|
44
|
+
config.product_properties_enabled = true
|
|
45
|
+
end
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
You can still use metafields, along side properties.
|
|
49
|
+
|
|
50
|
+
To migrate to metafields, you will need to run the following command:
|
|
51
|
+
|
|
52
|
+
```bash
|
|
53
|
+
bin/rake db:migrate_product_properties_to_metafields
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
This will migrate your current data to the new format.
|
|
57
|
+
|
|
58
|
+
Remember that you will need to update your API calls to fetch metafields instead of properties, eg.
|
|
59
|
+
|
|
60
|
+
```curl
|
|
61
|
+
curl --request GET \
|
|
62
|
+
--url 'https://demo.spreecommerce.org/api/v2/storefront/products/1?include=metafields' \
|
|
63
|
+
--header 'Accept: application/vnd.api+json'
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
### Migrate Product Details pages to PDP 2.0 with blocks and metafields
|
|
67
|
+
|
|
68
|
+
Spree 5.2 greatly enhances the product details page management in page builder with block support and metafields. To ensure your existing product details pages are migrated to the new system, run the following command:
|
|
69
|
+
|
|
70
|
+
```bash
|
|
71
|
+
bin/rake db:migrate_product_details_pages
|
|
72
|
+
```
|
|
73
|
+
|
|
74
|
+
This works great with our default storefront theme. If you're using a custom theme, you will need to adjust your templates.
|
|
75
|
+
|
|
76
|
+
### Migrate store policies
|
|
77
|
+
|
|
78
|
+
Spree 5.2 introduces more flexible way to manage store policies (eg. terms of service, privacy policy, returns policy, shipping policy).
|
|
79
|
+
|
|
80
|
+
Previously they were just attributes (rich text fields) on the Store model. Now they are stored in the new Policy model.
|
|
81
|
+
|
|
82
|
+
To migrate to the new system, you will need to run the following command:
|
|
83
|
+
|
|
84
|
+
```bash
|
|
85
|
+
bin/rake db:migrate_policies
|
|
86
|
+
```
|
|
87
|
+
|
|
88
|
+
This will migrate your current data to the new format.
|
|
89
|
+
|
|
90
|
+
> **WARNING:** If you're using a custom theme, you will need to adjust [app/views/spree/checkout/_footer.html.erb](https://github.com/spree/spree/blob/main/storefront/app/views/spree/checkout/_footer.html.erb) template to be able to manage checkout footer links which was also expanded (now you can link to Pages, Policies, URLs and more).
|
|
91
|
+
>
|
|
92
|
+
> `current_store.policies` won't work anymore, you will need to use `current_store.links` instead.
|
|
93
|
+
|
|
94
|
+
### Update Storefront to Tailwind v4 or stay on v3
|
|
95
|
+
|
|
96
|
+
Spree 5.2 introduces Tailwind v4 support for the Storefront. Tailwind v4 is a major upgrade from Tailwind v3.
|
|
97
|
+
|
|
98
|
+
#### Option A: Update to Tailwind v4
|
|
99
|
+
|
|
100
|
+
Running `bundle update` previously installed Tailwind v4. You only need to run
|
|
101
|
+
|
|
102
|
+
```bash
|
|
103
|
+
bin/rails g spree:storefront:install
|
|
104
|
+
```
|
|
105
|
+
|
|
106
|
+
This will:
|
|
107
|
+
|
|
108
|
+
1. Overwrite `config/tailwind.config.js` file with the new Tailwind v4 configuration.
|
|
109
|
+
2. Add `app/assets/tailwind/application.css` file with the new Tailwind v4 styles. If you modified `app/assets/stylesheets/application.tailwind.css` file, you will need to merge your changes with the new one.
|
|
110
|
+
|
|
111
|
+
#### Option B: Stay on Tailwind v3
|
|
112
|
+
|
|
113
|
+
You can stay on Tailwind v3 by running the following command:
|
|
114
|
+
|
|
115
|
+
Add these line to your `Gemfile`:
|
|
116
|
+
|
|
117
|
+
```ruby
|
|
118
|
+
gem "tailwindcss-rails", "~> 3.3.1" # which transitively pins tailwindcss-ruby to v3
|
|
119
|
+
```
|
|
120
|
+
|
|
121
|
+
and run:
|
|
122
|
+
|
|
123
|
+
```bash
|
|
124
|
+
bundle update tailwindcss-rails
|
|
125
|
+
```
|
|
126
|
+
|
|
127
|
+
This will install Tailwind v3 instead of Tailwind v4.
|
|
@@ -0,0 +1,338 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: Upgrading to Spree 5.3
|
|
3
|
+
description: This guide covers upgrading a Spree 5.2 application to Spree 5.3.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
> **INFO:** Before proceeding to upgrade, please ensure you're at [Spree 5.2](/developer/upgrades/5.1-to-5.2)
|
|
7
|
+
|
|
8
|
+
## Upgrade steps
|
|
9
|
+
|
|
10
|
+
### Update gems
|
|
11
|
+
|
|
12
|
+
```bash
|
|
13
|
+
bundle update
|
|
14
|
+
```
|
|
15
|
+
|
|
16
|
+
### Fetch and run missing migrations
|
|
17
|
+
|
|
18
|
+
```bash
|
|
19
|
+
bin/rake spree:install:migrations && bin/rails db:migrate
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
This will setup new database schema for the new features in Spree 5.3 like Price Lists and Customer Groups.
|
|
23
|
+
|
|
24
|
+
### Re-run Admin Panel Install Generator
|
|
25
|
+
|
|
26
|
+
Admin Panel was completely rewritten to use Tailwind v4 so you need to re-run the install generator to setup Tailwind and remove any Dart Sass related files.
|
|
27
|
+
|
|
28
|
+
```bash
|
|
29
|
+
bin/rails g spree:admin:install
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
This will also modify your `Procfile.dev` file to include the new Tailwind CSS watch task instead of the old Dart Sass watch task.
|
|
33
|
+
|
|
34
|
+
#### Add listen gem to Gemfile
|
|
35
|
+
|
|
36
|
+
You also need to add `listen` gem to your Gemfile in the development group, unless you already have it.
|
|
37
|
+
|
|
38
|
+
```ruby
|
|
39
|
+
group :development do
|
|
40
|
+
gem 'listen', '>= 3.0'
|
|
41
|
+
end
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
### Run counter cache rake tasks
|
|
45
|
+
|
|
46
|
+
Spree 5.3 introduces counter caches for products, taxons and variants. You need to run the following rake tasks to populate the counter caches:
|
|
47
|
+
|
|
48
|
+
```bash
|
|
49
|
+
bin/rake spree:products:reset_counter_caches
|
|
50
|
+
bin/rake spree:taxons:reset_counter_caches
|
|
51
|
+
bin/rake spree:variants:reset_counter_caches
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
This will greatly improve the performance of your application by avoiding N+1 queries.
|
|
55
|
+
|
|
56
|
+
> **WARNING:** You will need to run this rake task locally and on your production environment to ensure that the counter caches are populated correctly.
|
|
57
|
+
|
|
58
|
+
### Generate product metrics
|
|
59
|
+
|
|
60
|
+
Spree 5.3 introduces product metrics for products. You need to run the following rake task to populate the product metrics:
|
|
61
|
+
|
|
62
|
+
```bash
|
|
63
|
+
bin/rake spree:products:populate_metrics
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
This will populate the product metrics for all products in your database. Product metrics are used to sort products by best selling scope.
|
|
67
|
+
|
|
68
|
+
> **WARNING:** You will need to run this rake task locally and on your production environment to ensure that the product metrics are populated correctly.
|
|
69
|
+
|
|
70
|
+
This rake task will enqueue background jobs to populate the product metrics for all products in your database so you need to make sure that your background jobs are configured correctly.
|
|
71
|
+
|
|
72
|
+
### Replace `auto_strip_attributes` gem usage
|
|
73
|
+
|
|
74
|
+
`auto_strip_attributes` gem [was removed from Spree](https://github.com/spree/spree/pull/13462) due to bugs and conflicts with translations feature. Also it's not required anymore as built-in Rails `normalizes` provides the same feature without an additional depepdency.
|
|
75
|
+
|
|
76
|
+
If you used `auto_stripe_attributes` in your application, you will need to change it to `normalizez`, eg.
|
|
77
|
+
|
|
78
|
+
Replace
|
|
79
|
+
|
|
80
|
+
```ruby
|
|
81
|
+
auto_strip_attributes :name
|
|
82
|
+
```
|
|
83
|
+
|
|
84
|
+
With:
|
|
85
|
+
|
|
86
|
+
```ruby
|
|
87
|
+
normalizes :name, with: ->(value) { value&.to_s&.squish&.presence }
|
|
88
|
+
```
|
|
89
|
+
|
|
90
|
+
### Update Storefront to Tailwind v4 (Optional)
|
|
91
|
+
|
|
92
|
+
> **INFO:** This is optional if you're not using the `spree_storefront` gem.
|
|
93
|
+
|
|
94
|
+
Spree 5.3 requires Tailwind v4 as it's also used now for the Admin panel so you need to update your Storefront to Tailwind v4 as well.
|
|
95
|
+
|
|
96
|
+
If you didn't update your Storefront to Tailwind v4 in the previous upgrade guide, you need to do it now.
|
|
97
|
+
|
|
98
|
+
Running `bundle update` previously installed Tailwind v4. You only need to run
|
|
99
|
+
|
|
100
|
+
```bash
|
|
101
|
+
bin/rails g spree:storefront:install
|
|
102
|
+
```
|
|
103
|
+
|
|
104
|
+
This will:
|
|
105
|
+
|
|
106
|
+
1. Overwrite `config/tailwind.config.js` file with the new Tailwind v4 configuration.
|
|
107
|
+
2. Add `app/assets/tailwind/application.css` file with the new Tailwind v4 styles. If you modified `app/assets/stylesheets/application.tailwind.css` file, you will need to merge your changes with the new one.
|
|
108
|
+
|
|
109
|
+
### Update Storefront to use `pagy` instead of `kaminari` (Optional)
|
|
110
|
+
|
|
111
|
+
> **INFO:** This is optional if you're not using the `spree_storefront` gem.
|
|
112
|
+
|
|
113
|
+
Spree 5.3 introduces [pagy](https://ddnexus.github.io/pagy/) as the default pagination gem. Pagy is a faster and more memory-efficient pagination gem than Kaminari. This works automatically for the API and Admin panel.
|
|
114
|
+
|
|
115
|
+
For Storefront, you need to either update your theme (if you're not using the default theme) or set `use_kaminari_pagination` preference to `true` in your `config/initializers/spree.rb` file.
|
|
116
|
+
|
|
117
|
+
#### Products infinite scroll fix
|
|
118
|
+
|
|
119
|
+
Please replace the contents of your `show_more_button.html.erb` with the following code:
|
|
120
|
+
|
|
121
|
+
```erb
|
|
122
|
+
<% if storefront_pagy&.next %>
|
|
123
|
+
<%= turbo_frame_tag "next_page", src: url_for(params.to_unsafe_h.merge(page: storefront_pagy.next, format: :turbo_stream)), class: "block relative w-full", data: { controller: "infinite-scroll", infinite_scroll_offset_value: "1350px" }, loading: "lazy" do %>
|
|
124
|
+
<span class="flex justify-center gap-2 items-center py-4 left-0 w-full h-full">
|
|
125
|
+
<%= render 'spree/shared/icons/spinner' %>
|
|
126
|
+
<%= Spree.t(:loading) %>...
|
|
127
|
+
</span>
|
|
128
|
+
<% end %>
|
|
129
|
+
<% end %>
|
|
130
|
+
```
|
|
131
|
+
|
|
132
|
+
#### Posts pagination
|
|
133
|
+
|
|
134
|
+
In the following files:
|
|
135
|
+
|
|
136
|
+
* `page_sections/_post_grid.html.erb`
|
|
137
|
+
* `posts/_pagination.html.erb`
|
|
138
|
+
|
|
139
|
+
Replace this line:
|
|
140
|
+
|
|
141
|
+
```erb
|
|
142
|
+
<%= paginate @posts, theme: 'storefront', outer_window: 1, inner_window: 2 %>
|
|
143
|
+
```
|
|
144
|
+
|
|
145
|
+
with this line:
|
|
146
|
+
|
|
147
|
+
```erb
|
|
148
|
+
<%= render 'spree/shared/pagination' %>
|
|
149
|
+
```
|
|
150
|
+
|
|
151
|
+
|
|
152
|
+
### Include Page Builder factories (Optional)
|
|
153
|
+
|
|
154
|
+
Page Builder was extracted to a separate gem (`spree_page_builder`) so you need to include the Page Builder factories in your test suite if you were using them in your tests
|
|
155
|
+
|
|
156
|
+
Add this line to your `spec_helper.rb` file:
|
|
157
|
+
|
|
158
|
+
```ruby
|
|
159
|
+
require 'spree/page_builder/testing_support/factories'
|
|
160
|
+
```
|
|
161
|
+
|
|
162
|
+
## Updating Spree Extensions
|
|
163
|
+
|
|
164
|
+
If you maintain a Spree extension, the following changes may be required to ensure compatibility with Spree 5.3.
|
|
165
|
+
|
|
166
|
+
### Admin Controller Changes
|
|
167
|
+
|
|
168
|
+
#### Use `prepend_before_action` for filters that modify `params[:q]`
|
|
169
|
+
|
|
170
|
+
In Spree 5.3, the `ResourceController#load_resource` before_action calls `collection` which builds the search query using `search_params`. If your extension uses before_actions to load data needed for filtering (e.g., loading a vendor to filter products), you must use `prepend_before_action` to ensure your filter runs before `load_resource`.
|
|
171
|
+
|
|
172
|
+
**Before (Spree 5.2):**
|
|
173
|
+
|
|
174
|
+
```ruby
|
|
175
|
+
module MyExtension
|
|
176
|
+
module Admin
|
|
177
|
+
module ProductsControllerDecorator
|
|
178
|
+
def self.prepended(base)
|
|
179
|
+
base.before_action :load_vendor, only: :index
|
|
180
|
+
end
|
|
181
|
+
end
|
|
182
|
+
end
|
|
183
|
+
end
|
|
184
|
+
```
|
|
185
|
+
|
|
186
|
+
**After (Spree 5.3):**
|
|
187
|
+
|
|
188
|
+
```ruby
|
|
189
|
+
module MyExtension
|
|
190
|
+
module Admin
|
|
191
|
+
module ProductsControllerDecorator
|
|
192
|
+
def self.prepended(base)
|
|
193
|
+
base.prepend_before_action :load_vendor, only: :index
|
|
194
|
+
end
|
|
195
|
+
end
|
|
196
|
+
end
|
|
197
|
+
end
|
|
198
|
+
```
|
|
199
|
+
|
|
200
|
+
#### Replace `assign_extra_collection_params` with `search_params` override
|
|
201
|
+
|
|
202
|
+
The `assign_extra_collection_params` method is no longer used in Spree 5.3. Instead, override the `search_params` method to add custom Ransack filters.
|
|
203
|
+
|
|
204
|
+
**Before (Spree 5.2):**
|
|
205
|
+
|
|
206
|
+
```ruby
|
|
207
|
+
def assign_extra_collection_params
|
|
208
|
+
params[:q][:vendor_id_eq] = @vendor.id if @vendor.present?
|
|
209
|
+
end
|
|
210
|
+
```
|
|
211
|
+
|
|
212
|
+
**After (Spree 5.3):**
|
|
213
|
+
|
|
214
|
+
```ruby
|
|
215
|
+
def search_params
|
|
216
|
+
result = super
|
|
217
|
+
result[:vendor_id_eq] = @vendor.id if @vendor.present?
|
|
218
|
+
result
|
|
219
|
+
end
|
|
220
|
+
```
|
|
221
|
+
|
|
222
|
+
#### Date range filtering changes
|
|
223
|
+
|
|
224
|
+
The base `ResourceController#search_params` now processes date range params (`created_at_gt`, `created_at_lt`, etc.) and converts them to `beginning_of_day`. If you need `end_of_day` for `_lt` params, override `search_params` with custom handling:
|
|
225
|
+
|
|
226
|
+
```ruby
|
|
227
|
+
def search_params
|
|
228
|
+
params[:q] ||= {}
|
|
229
|
+
params[:q][:s] ||= collection_default_sort if collection_default_sort.present?
|
|
230
|
+
|
|
231
|
+
if params[:q][:created_at_gt].present?
|
|
232
|
+
params[:q][:created_at_gt] = parse_date_param(params[:q][:created_at_gt])
|
|
233
|
+
end
|
|
234
|
+
|
|
235
|
+
if params[:q][:created_at_lt].present?
|
|
236
|
+
params[:q][:created_at_lt] = parse_date_param(params[:q][:created_at_lt])&.end_of_day
|
|
237
|
+
end
|
|
238
|
+
|
|
239
|
+
params[:q]
|
|
240
|
+
end
|
|
241
|
+
```
|
|
242
|
+
|
|
243
|
+
### Admin Tables API
|
|
244
|
+
|
|
245
|
+
The old filter partial system (`Spree.admin.partials.*_filters`) has been replaced with built-in filtering in the Tables API. Remove any filter partials and configure filtering directly in table column definitions.
|
|
246
|
+
|
|
247
|
+
**Before (Spree 5.2):**
|
|
248
|
+
|
|
249
|
+
```ruby
|
|
250
|
+
Spree.admin.partials.orders_filters << 'spree/admin/orders/vendor_filter'
|
|
251
|
+
```
|
|
252
|
+
|
|
253
|
+
**After (Spree 5.3):**
|
|
254
|
+
|
|
255
|
+
```ruby
|
|
256
|
+
Spree.admin.tables.orders.add :vendor,
|
|
257
|
+
label: :vendor,
|
|
258
|
+
type: :custom,
|
|
259
|
+
filterable: true,
|
|
260
|
+
filter_type: :select,
|
|
261
|
+
ransack_attribute: :vendor_id_eq,
|
|
262
|
+
value_options: -> { Spree::Vendor.pluck(:name, :id) },
|
|
263
|
+
partial: 'spree/admin/orders/table/vendor_column'
|
|
264
|
+
```
|
|
265
|
+
|
|
266
|
+
See the [Admin Tables documentation](/developer/admin/tables) for more details.
|
|
267
|
+
|
|
268
|
+
### Tailwind CSS v4 Migration
|
|
269
|
+
|
|
270
|
+
If your extension includes admin views with CSS classes, update Bootstrap utility classes to Tailwind v4:
|
|
271
|
+
|
|
272
|
+
| Bootstrap | Tailwind v4 |
|
|
273
|
+
|-----------|-------------|
|
|
274
|
+
| `d-flex` | `flex` |
|
|
275
|
+
| `d-none` | `hidden` |
|
|
276
|
+
| `text-muted` | `text-gray-500` |
|
|
277
|
+
| `ml-2`, `mr-2` | `ms-2`, `me-2` |
|
|
278
|
+
| `pl-2`, `pr-2` | `ps-2`, `pe-2` |
|
|
279
|
+
| `font-weight-bold` | `font-bold` |
|
|
280
|
+
|
|
281
|
+
### Stimulus Tabs Controller
|
|
282
|
+
|
|
283
|
+
If your extension uses Bootstrap tabs, migrate to the Stimulus tabs controller:
|
|
284
|
+
|
|
285
|
+
**Before (Bootstrap):**
|
|
286
|
+
|
|
287
|
+
```erb
|
|
288
|
+
<ul class="nav nav-tabs">
|
|
289
|
+
<li class="nav-item">
|
|
290
|
+
<a class="nav-link active" data-toggle="tab" href="#tab1">Tab 1</a>
|
|
291
|
+
</li>
|
|
292
|
+
</ul>
|
|
293
|
+
<div class="tab-content">
|
|
294
|
+
<div class="tab-pane active" id="tab1">Content</div>
|
|
295
|
+
</div>
|
|
296
|
+
```
|
|
297
|
+
|
|
298
|
+
**After (Stimulus):**
|
|
299
|
+
|
|
300
|
+
```erb
|
|
301
|
+
<div data-controller="tabs">
|
|
302
|
+
<ul class="nav nav-pills mb-4" role="tablist">
|
|
303
|
+
<li class="nav-item" role="presentation">
|
|
304
|
+
<a class="nav-link active" data-tabs-target="tab" data-action="click->tabs#select" role="tab">Tab 1</a>
|
|
305
|
+
</li>
|
|
306
|
+
</ul>
|
|
307
|
+
<div data-tabs-target="panel" role="tabpanel" class="animate-fade-in">Content</div>
|
|
308
|
+
</div>
|
|
309
|
+
```
|
|
310
|
+
|
|
311
|
+
### Progress Bar Component
|
|
312
|
+
|
|
313
|
+
The `progress_bar_component` signature has changed:
|
|
314
|
+
|
|
315
|
+
**Before (Spree 5.2):**
|
|
316
|
+
|
|
317
|
+
```erb
|
|
318
|
+
<%= progress_bar_component(value, 0, 100) %>
|
|
319
|
+
```
|
|
320
|
+
|
|
321
|
+
**After (Spree 5.3):**
|
|
322
|
+
|
|
323
|
+
```erb
|
|
324
|
+
<%= progress_bar_component(value, min: 0, max: 100) %>
|
|
325
|
+
```
|
|
326
|
+
|
|
327
|
+
### Table Column Visibility
|
|
328
|
+
|
|
329
|
+
All table columns now require `default: true` to be visible by default:
|
|
330
|
+
|
|
331
|
+
```ruby
|
|
332
|
+
Spree.admin.tables.vendors.add :name,
|
|
333
|
+
label: :name,
|
|
334
|
+
type: :string,
|
|
335
|
+
sortable: true,
|
|
336
|
+
default: true, # Required for column to be visible
|
|
337
|
+
position: 10
|
|
338
|
+
```
|