Skip to content

armgit / spree

Public Imported from GitHub
0

Open Source Platform for DTC, B2B Commerce, Marketplaces & Omnichannel. REST APIs, TypeScript SDKs, and production-ready Next.js storefront. Self-host it. Own your data. No vendor lock-in. Zero platform fees.

Fix: repair Metafields to Custom Fields sweep damage

Damian Legawiec72f32e9eb441
diff --git a/docs/developer/customization/model-preferences.mdx b/docs/developer/customization/model-preferences.mdx
index 86161cd843..1cd789d462 100644
--- a/docs/developer/customization/model-preferences.mdx
+++ b/docs/developer/customization/model-preferences.mdx
@@ -17,7 +17,7 @@ To define a model preference, you need to add them to your model class.
Make sure to generate a migration to add the `preferences` column to the table. This column will store the preferences in a serialized format.
```bash
-spree generate migration AddPreferencesToSpreeUsers preferences:text
+spree generate migration AddPreferencesToSpreeBrands preferences:text
```
Run the migration.
diff --git a/docs/developer/how-to/custom-stock-splitter.mdx b/docs/developer/how-to/custom-stock-splitter.mdx
index 59d4898856..9af2ad469a 100644
--- a/docs/developer/how-to/custom-stock-splitter.mdx
+++ b/docs/developer/how-to/custom-stock-splitter.mdx
@@ -175,7 +175,7 @@ The example above relies on `variant.refrigerated?`. In a real plugin you'd back
```ruby app/models/spree/variant_decorator.rb
Spree::Variant.class_eval do
def refrigerated?
- custom fields.find_by(namespace: 'logistics', key: 'refrigerated')&.value == 'true'
+ custom_fields.find_by(namespace: 'logistics', key: 'refrigerated')&.value == 'true'
end
end
```
diff --git a/docs/developer/sdk/configuration.mdx b/docs/developer/sdk/configuration.mdx
index b84ea44fd5..fb2bedfcec 100644
--- a/docs/developer/sdk/configuration.mdx
+++ b/docs/developer/sdk/configuration.mdx
@@ -156,7 +156,7 @@ All types are exported as unprefixed names (e.g., `Product`, `Order`). Legacy `S
- `OptionType` - Option type (e.g., Size, Color)
- `OptionValue` - Option value (e.g., Small, Red)
- `DigitalLink` - Digital download link
-- `Custom Field` - Custom custom field data
+- `CustomField` - Custom field data
### Wishlist Types
- `Wishlist` - Wishlist
diff --git a/docs/user/manage-products/product-import-file-template.mdx b/docs/user/manage-products/product-import-file-template.mdx
index 8bc3bf03d9..56ddfc60a2 100644
--- a/docs/user/manage-products/product-import-file-template.mdx
+++ b/docs/user/manage-products/product-import-file-template.mdx
@@ -50,4 +50,4 @@ For an example of **how to structure multi-variant products**, please download t
| category1 | The 1st [category](https://spreecommerce.org/docs/user/products/categories) to which the product should be assigned|
| category2 | The 2nd category to which the product should be assigned |
| category3 | The 3rd category to which the product should be assigned |
-| custom field.namespace.key | The value for the product custom field [namespace.key](https://spreecommerce.org/docs/user/settings/metafields)|
+| custom_field.namespace.key | The value for the product custom field [namespace.key](https://spreecommerce.org/docs/user/settings/metafields)|
diff --git a/docs/user/manage-products/product-metafields.mdx b/docs/user/manage-products/product-metafields.mdx
index 9cc2add300..cf8708a7af 100644
--- a/docs/user/manage-products/product-metafields.mdx
+++ b/docs/user/manage-products/product-metafields.mdx
@@ -31,7 +31,7 @@ To create a new product custom field, navigate to **Settings → Custom Field De
Click **New Custom Field Definition** to open the custom field creation form.
-![Adding a new product custom field in the Spree Commerce dashboard](/docs/images/user/products/product-metafields/2-add-custom fields.png)
+![Adding a new product custom field in the Spree Commerce dashboard](/docs/images/user/products/product-metafields/2-add-metafields.png)
Complete the form fields as described below.
@@ -148,7 +148,7 @@ Once the definition is created, you can assign values to individual products.
### Adding Values Individually
-![Adding custom field values to a product in Spree Commerce](/docs/images/user/products/product-metafields/3-custom fields-values.png)
+![Adding custom field values to a product in Spree Commerce](/docs/images/user/products/product-metafields/3-metafields-values.png)
To add custom field values for individual products:
@@ -169,13 +169,13 @@ You can also import custom fields via CSV.
Use this format:
-**custom field.namespace.key**
+**custom_field.namespace.key**
Example:
-- **custom field.custom.material**
-- **custom field.custom.care_instructions**
-- **custom field.custom.sustainability_score**
+- **custom_field.custom.material**
+- **custom_field.custom.care_instructions**
+- **custom_field.custom.sustainability_score**
#### Step 2: Add Values Per Product Row
diff --git a/docs/user/settings/metafields.mdx b/docs/user/settings/metafields.mdx
index 7e58d4b4d1..42bbd686cb 100644
--- a/docs/user/settings/metafields.mdx
+++ b/docs/user/settings/metafields.mdx
@@ -1,6 +1,6 @@
---
title: "Custom Field Definitions"
-description: "Define and manage custom custom fields in Spree to attach extra structured data to products, orders, and other store objects without code changes."
+description: "Define and manage custom fields in Spree to attach extra structured data to products, orders, and other store objects without code changes."
---
Custom Fields in Spree allow you to attach custom data to nearly any object in your store - without needing to write a single line of code or modify the database.
@@ -11,13 +11,13 @@ From product materials to internal order notes, custom fields give you the flexi
To create a custom field definition go to **Settings → Custom Field Definitions**
-![Spree Commerce custom fields](/docs/images/user/settings/metafields/1-settings-custom fields.png)
+![Spree Commerce custom fields](/docs/images/user/settings/metafields/1-settings-metafields.png)
Here you’ll see a list of all existing custom field definitions in your store. 
To add a new one, click **New Custom Field Definition** in the top right corner.
-![Creating custom fields in Spree](/docs/images/user/settings/metafields/2-create-a-custom field.png)
+![Creating custom fields in Spree](/docs/images/user/settings/metafields/2-create-a-metafield.png)
Fill out the form with the required details:
@@ -33,7 +33,7 @@ Fill out the form with the required details:
### Supported Resources
-![Add a custom field definition in Spree](/docs/images/user/settings/metafields/3-custom field-resource.png)
+![Add a custom field definition in Spree](/docs/images/user/settings/metafields/3-metafield-resource.png)
You can define custom fields for nearly any data object in Spree:
@@ -71,7 +71,7 @@ You can define custom fields for nearly any data object in Spree:
### Supported Data Types
-![Spree Commerce custom field resources](/docs/images/user/settings/metafields/4-custom field-type.png)
+![Spree Commerce custom field resources](/docs/images/user/settings/metafields/4-metafield-type.png)
Each custom field must be assigned a **type**, which determines the format of the stored value. Choosing the right type helps keep data structured, valid, and useful across the storefront and admin.
@@ -90,15 +90,15 @@ Once your custom field definition has been created, you can enter values in a fe
First, navigate to the relevant resource (e.g., Product, Order, Shipment).
-![Spree Commerce custom field data types](/docs/images/user/settings/metafields/5-add-custom field-value.png)
+![Spree Commerce custom field data types](/docs/images/user/settings/metafields/5-add-metafield-value.png)
Click the **three-dot menu** in the top right corner and select **Custom Fields** from the dropdown.
-![Adding custom fields values in Spree](/docs/images/user/settings/metafields/6-select-custom fields.png)
+![Adding custom fields values in Spree](/docs/images/user/settings/metafields/6-select-metafields.png)
Enter the desired values in the form and click **Save** to finalized your changes.
-![Product custom fields in Spree](/docs/images/user/settings/metafields/7-enter-custom field-values.png)
+![Product custom fields in Spree](/docs/images/user/settings/metafields/7-enter-metafield-values.png)
This works for any individual resource type and is perfect for adding or editing a few custom fields manually.
@@ -106,7 +106,7 @@ This works for any individual resource type and is perfect for adding or editing
Product custom fields can also be imported or updated in bulk by:
-1. Adding columns to your CSV file using this format: custom field.namespace.key (e.g. custom field.custom.material)
+1. Adding columns to your CSV file using this format: custom_field.namespace.key (e.g. custom_field.custom.material)
2. Entering the desired values for each product row.
3. Importing the file when uploading a new product catalog
diff --git a/packages/dashboard-starter/README.md b/packages/dashboard-starter/README.md
index 35887b80d9..2cb9cb0e02 100644
--- a/packages/dashboard-starter/README.md
+++ b/packages/dashboard-starter/README.md
@@ -121,7 +121,11 @@ i18n.addResourceBundle('en', 'translation', en, true, true)
## Test
-Vitest and Playwright are configured — no setup needed.
+Vitest and Playwright are configured. Playwright needs its browser once:
+
+```bash
+pnpm exec playwright install chromium
+```
```bash
pnpm test # unit tests: src/**/*.test.ts