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.
Ruby b2b-commercee-commerceecommerceecommerce-apiecommerce-frameworkecommerce-platformheadlessheadless-commerceheadless-ecommercemarketplacemulti-tenantmulti-vendormulti-vendor-ecommerceopen-sourcespree-commerce
🇪🇺 Feat: support EU omnibus directive for price history (#13817)
Damian Legawiec21255d9b78d3
diff --git a/CLAUDE.md b/CLAUDE.mdindex ebd3dd6098..221c0712c0 100644--- a/CLAUDE.md+++ b/CLAUDE.md@@ -29,6 +29,7 @@ Current plans:- `6.0-delivery-rate-provider.md` — Per-DeliveryMethod DeliveryRateProvider, replaces Estimator + Calculator, DeliveryZone with postal code support- `6.0-rich-text-descriptions.md` — Drop ActionText storage, store HTML in text columns, sanitize on write, serve `description` + `description_html` in API- `5.4-store-api-naming-standardization.md` — Standardize API naming against industry (address fields, discounts, customer_note, label, brand/last4, etc.)+- `5.4-6.0-eu-legal-compliance.md` — GDPR (data export/anonymization, consent timestamps), Omnibus (PriceHistory, lowest-in-30-days), Consumer Rights (withdrawal period). Core primitives + enterprise hooks.Completed plans:- `5.4-store-api-bridges.md` — Bridge 6.0 naming into 5.4 Store API (implemented, PR #13782)diff --git a/docs/api-reference/store.yaml b/docs/api-reference/store.yamlindex f38eded7ae..8d554334d8 100644--- a/docs/api-reference/store.yaml+++ b/docs/api-reference/store.yaml@@ -590,17 +590,17 @@ paths:content:application/json:example:- token: eyJhbGciOiJIUzI1NiJ9.eyJ1c2VyX2lkIjoxLCJ1c2VyX3R5cGUiOiJjdXN0b21lciIsImp0aSI6ImYwNWZhZGFiLWM2ZGYtNDcyMy05NTdlLTE4MDM4MGE1MjJjYiIsImlzcyI6InNwcmVlIiwiYXVkIjoic3RvcmVfYXBpIiwiZXhwIjoxNzc0MjYyODEyfQ.WDd_6bKcxBEivJUj00OyLN0UPsQhfXfYoMngY1iMrO4- refresh_token: xR2Pt7CKvGCnEkTZEcbr3xpC+ token: eyJhbGciOiJIUzI1NiJ9.eyJ1c2VyX2lkIjoxLCJ1c2VyX3R5cGUiOiJjdXN0b21lciIsImp0aSI6ImUyMzFkMjU4LTcyZDQtNDJlZS04OGYyLTI1NjFmMGIxNDFhNiIsImlzcyI6InNwcmVlIiwiYXVkIjoic3RvcmVfYXBpIiwiZXhwIjoxNzc0MzUzOTE1fQ.ITqNPF04ehqvkdhalyYCwWR5j1tadRAOaEVomin0rpU+ refresh_token: gijniFRnfEMpic9UtcidKCgEuser:id: cus_UkLWZg9DAJemail: [email protected]- first_name: Antionette- last_name: Eichmann+ first_name: Kitty+ last_name: Bergnaumphone:accepts_email_marketing: false- created_at: '2026-03-23T09:46:52.288Z'- updated_at: '2026-03-23T09:46:52.288Z'+ created_at: '2026-03-24T11:05:14.866Z'+ updated_at: '2026-03-24T11:05:14.866Z'available_store_credit_total: '0'display_available_store_credit_total: "$0.00"addresses: []@@ -673,17 +673,17 @@ paths:content:application/json:example:- token: eyJhbGciOiJIUzI1NiJ9.eyJ1c2VyX2lkIjoxLCJ1c2VyX3R5cGUiOiJjdXN0b21lciIsImp0aSI6IjJjNWQ0MzcwLWRhNTgtNDNiMy1hMThmLTllOGI2MTFmYWQ5MiIsImlzcyI6InNwcmVlIiwiYXVkIjoic3RvcmVfYXBpIiwiZXhwIjoxNzc0MjYyODEzfQ.o81wrve9qORIApLafz0AJT1Bb8eHYaBv6gjqo_JKnaw- refresh_token: rBw6Yx2A225y3ph2YjRmf7SR+ token: eyJhbGciOiJIUzI1NiJ9.eyJ1c2VyX2lkIjoxLCJ1c2VyX3R5cGUiOiJjdXN0b21lciIsImp0aSI6Ijc1YTA4Mzk4LWM2N2ItNGYzMS05NDE3LWM2ZDI5NzIxYjc5MCIsImlzcyI6InNwcmVlIiwiYXVkIjoic3RvcmVfYXBpIiwiZXhwIjoxNzc0MzUzOTE2fQ.3vk-woF89efUSXH4ACetfIwTAnv7gH6OxWm4t0gj-4w+ refresh_token: 5zhggqsZmsjg2fsSSCiGpGhcuser:id: cus_UkLWZg9DAJemail: [email protected]- first_name: Donte- last_name: Frami+ first_name: Marna+ last_name: Roobphone:accepts_email_marketing: false- created_at: '2026-03-23T09:46:53.689Z'- updated_at: '2026-03-23T09:46:53.689Z'+ created_at: '2026-03-24T11:05:16.295Z'+ updated_at: '2026-03-24T11:05:16.295Z'available_store_credit_total: '0'display_available_store_credit_total: "$0.00"addresses: []@@ -800,9 +800,9 @@ paths:example:data:- id: cart_gbHJdmfrXB- number: R924172813- token: EKiCpQJa3wYoyN1jx5wp3cXBUKCryTqnxNT- email: [email protected]+ number: R006942926+ token: 6qQ6pdQFbUJ9VtEJYxZzWtiWEWSfNNqMpfk+ email: [email protected]customer_note:currency: USDlocale: en@@ -823,8 +823,8 @@ paths:display_total: "$110.00"delivery_total: '100.0'display_delivery_total: "$100.00"- created_at: '2026-03-23T09:46:55.808Z'- updated_at: '2026-03-23T09:46:55.858Z'+ created_at: '2026-03-24T11:05:18.437Z'+ updated_at: '2026-03-24T11:05:18.490Z'store_credit_total: '0.0'display_store_credit_total: "$0.00"gift_card_total: '0.0'@@ -843,8 +843,8 @@ paths:variant_id: variant_gbHJdmfrXBquantity: 1currency: USD- name: Product 21603- slug: product-21603+ name: Product 25091+ slug: product-25091options_text: ''price: '10.0'display_price: "$10.00"@@ -863,21 +863,21 @@ paths:discounted_amount: '10.0'display_discounted_amount: "$10.00"display_compare_at_amount: "$0.00"- created_at: '2026-03-23T09:46:55.837Z'- updated_at: '2026-03-23T09:46:55.837Z'+ created_at: '2026-03-24T11:05:18.469Z'+ updated_at: '2026-03-24T11:05:18.469Z'compare_at_amount:thumbnail_url:option_values: []digital_links: []fulfillments:- id: ful_gbHJdmfrXB- number: H09789131868+ number: H77648156123tracking: U10000tracking_url:cost: '100.0'display_cost: "$100.00"- created_at: '2026-03-23T09:46:55.844Z'- updated_at: '2026-03-23T09:46:55.856Z'+ created_at: '2026-03-24T11:05:18.477Z'+ updated_at: '2026-03-24T11:05:18.488Z'status: pendingfulfillment_type: shippingfulfilled_at:@@ -892,7 +892,7 @@ paths:stock_location:id: sloc_UkLWZg9DAJstate_abbr: STATE_ABBR_32- name: Celestina Olson+ name: Georgianna Hintzaddress1: 1600 Pennsylvania Ave NWcity: Washingtonzipcode: '20500'@@ -952,9 +952,9 @@ paths:payment_methods: []gift_card:- id: cart_UkLWZg9DAJ- number: R025508041- token: wYaCkVMobq3zaK93hAPc54ecudtmKDHrjfr- email: [email protected]+ number: R446234317+ token: 7pYs3jswX8ch9VNeqqxEUwjVVjx7JpmFs6t+ email: [email protected]customer_note:currency: USDlocale: en@@ -975,8 +975,8 @@ paths:display_total: "$110.00"delivery_total: '100.0'display_delivery_total: "$100.00"- created_at: '2026-03-23T09:46:55.645Z'- updated_at: '2026-03-23T09:46:55.802Z'+ created_at: '2026-03-24T11:05:18.273Z'+ updated_at: '2026-03-24T11:05:18.430Z'store_credit_total: '0'display_store_credit_total: "$0.00"gift_card_total: '0.0'@@ -995,8 +995,8 @@ paths:variant_id: variant_UkLWZg9DAJquantity: 1currency: USD- name: Product 11471- slug: product-11471+ name: Product 11693+ slug: product-11693options_text: ''price: '10.0'display_price: "$10.00"@@ -1015,21 +1015,21 @@ paths:discounted_amount: '10.0'display_discounted_amount: "$10.00"display_compare_at_amount: "$0.00"- created_at: '2026-03-23T09:46:55.721Z'- updated_at: '2026-03-23T09:46:55.721Z'+ created_at: '2026-03-24T11:05:18.353Z'+ updated_at: '2026-03-24T11:05:18.353Z'compare_at_amount:thumbnail_url:option_values: []digital_links: []fulfillments:- id: ful_UkLWZg9DAJ- number: H77816392993+ number: H65792432005tracking: U10000tracking_url:cost: '100.0'display_cost: "$100.00"- created_at: '2026-03-23T09:46:55.736Z'- updated_at: '2026-03-23T09:46:55.796Z'+ created_at: '2026-03-24T11:05:18.366Z'+ updated_at: '2026-03-24T11:05:18.424Z'status: pendingfulfillment_type: shippingfulfilled_at:@@ -1044,7 +1044,7 @@ paths:stock_location:id: sloc_UkLWZg9DAJstate_abbr: STATE_ABBR_32- name: Celestina Olson+ name: Georgianna Hintzaddress1: 1600 Pennsylvania Ave NWcity: Washingtonzipcode: '20500'@@ -1177,8 +1177,8 @@ paths:application/json:example:id: cart_UkLWZg9DAJ- number: R716592162- token: 2zQSF1vyMJHi9Mot1fuyyUhMjLJ9h1RrFX5+ number: R811755379+ token: 6FCZTsMTYxQaTmqJH8rf2sxnNTnGDMe4nKMemail:customer_note:currency: USD@@ -1200,8 +1200,8 @@ paths:display_total: "$0.00"delivery_total: '0.0'display_delivery_total: "$0.00"- created_at: '2026-03-23T09:46:56.362Z'- updated_at: '2026-03-23T09:46:56.362Z'+ created_at: '2026-03-24T11:05:18.982Z'+ updated_at: '2026-03-24T11:05:18.982Z'store_credit_total: '0.0'display_store_credit_total: "$0.00"gift_card_total: '0.0'@@ -1315,9 +1315,9 @@ paths:application/json:example:id: cart_UkLWZg9DAJ- number: R268304368- token: En7wj5qcxESv3EebCmYdjhnui8Pov9vBSmL- email: [email protected]+ number: R142439546+ token: FC6u77rCTbiLxUfVfBfp4Yk4AEJCDT1nJxY+ email: [email protected]customer_note:currency: USDlocale: en@@ -1338,8 +1338,8 @@ paths:display_total: "$110.00"delivery_total: '100.0'display_delivery_total: "$100.00"- created_at: '2026-03-23T09:46:56.650Z'- updated_at: '2026-03-23T09:46:56.708Z'+ created_at: '2026-03-24T11:05:19.265Z'+ updated_at: '2026-03-24T11:05:19.326Z'store_credit_total: '0.0'display_store_credit_total: "$0.00"gift_card_total: '0.0'@@ -1358,8 +1358,8 @@ paths:variant_id: variant_UkLWZg9DAJquantity: 1currency: USD- name: Product 57741- slug: product-57741+ name: Product 57580+ slug: product-57580options_text: ''price: '10.0'display_price: "$10.00"@@ -1378,21 +1378,21 @@ paths:discounted_amount: '10.0'display_discounted_amount: "$10.00"display_compare_at_amount: "$0.00"- created_at: '2026-03-23T09:46:56.684Z'- updated_at: '2026-03-23T09:46:56.684Z'+ created_at: '2026-03-24T11:05:19.302Z'+ updated_at: '2026-03-24T11:05:19.302Z'compare_at_amount:thumbnail_url:option_values: []digital_links: []fulfillments:- id: ful_UkLWZg9DAJ- number: H52062195535+ number: H62242796409tracking: U10000tracking_url:cost: '100.0'display_cost: "$100.00"- created_at: '2026-03-23T09:46:56.689Z'- updated_at: '2026-03-23T09:46:56.705Z'+ created_at: '2026-03-24T11:05:19.308Z'+ updated_at: '2026-03-24T11:05:19.324Z'status: pendingfulfillment_type: shippingfulfilled_at:@@ -1407,7 +1407,7 @@ paths:stock_location:id: sloc_UkLWZg9DAJstate_abbr: STATE_ABBR_42- name: Terri Kilback+ name: Simona Gradyaddress1: 1600 Pennsylvania Ave NWcity: Washingtonzipcode: '20500'@@ -1546,9 +1546,9 @@ paths:application/json:example:id: cart_UkLWZg9DAJ- number: R643287117- token: 5cUFxrcXZRdYJD6Tbz2yEUBcEaK9utgxwNz- email: [email protected]+ number: R596219891+ token: 5jQ5ojyeJzdaQDXNhDBKegTRZrWJ84jzBYg+ email: [email protected]customer_note: Leave at doorcurrency: USDlocale: en@@ -1569,8 +1569,8 @@ paths:display_total: "$29.99"delivery_total: '10.0'display_delivery_total: "$10.00"- created_at: '2026-03-23T09:46:57.310Z'- updated_at: '2026-03-23T09:46:57.460Z'+ created_at: '2026-03-24T11:05:19.912Z'+ updated_at: '2026-03-24T11:05:20.074Z'store_credit_total: '0.0'display_store_credit_total: "$0.00"gift_card_total: '0.0'@@ -1591,8 +1591,8 @@ paths:variant_id: variant_UkLWZg9DAJquantity: 1currency: USD- name: Product 69059- slug: product-69059+ name: Product 62880+ slug: product-62880options_text: ''price: '19.99'display_price: "$19.99"@@ -1611,21 +1611,21 @@ paths:discounted_amount: '19.99'display_discounted_amount: "$19.99"display_compare_at_amount: "$0.00"- created_at: '2026-03-23T09:46:57.348Z'- updated_at: '2026-03-23T09:46:57.413Z'+ created_at: '2026-03-24T11:05:19.957Z'+ updated_at: '2026-03-24T11:05:20.029Z'compare_at_amount:thumbnail_url:option_values: []digital_links: []fulfillments:- id: ful_gbHJdmfrXB- number: H86727849517+ number: H58405017329tracking:tracking_url:cost: '10.0'display_cost: "$10.00"- created_at: '2026-03-23T09:46:57.432Z'- updated_at: '2026-03-23T09:46:57.445Z'+ created_at: '2026-03-24T11:05:20.046Z'+ updated_at: '2026-03-24T11:05:20.059Z'status: pendingfulfillment_type: shippingfulfilled_at:@@ -1640,7 +1640,7 @@ paths:stock_location:id: sloc_UkLWZg9DAJstate_abbr: STATE_ABBR_44- name: Phyliss Okuneva+ name: Miguel Gerholdaddress1: 1600 Pennsylvania Ave NWcity: Washingtonzipcode: '20500'@@ -1867,9 +1867,9 @@ paths:application/json:example:id: cart_UkLWZg9DAJ- number: R060374466- token: TbWX5EuG5xhXpGsCNeiwaLDJihBXpQoQBPR- email: [email protected]+ number: R847028704+ token: gMTHheRSZqXPxnKUT1sCV3J9hAXmcqGruCn+ email: [email protected]customer_note:currency: USDlocale: en@@ -1890,8 +1890,8 @@ paths:display_total: "$110.00"delivery_total: '100.0'display_delivery_total: "$100.00"- created_at: '2026-03-23T09:46:58.142Z'- updated_at: '2026-03-23T09:46:58.231Z'+ created_at: '2026-03-24T11:05:20.752Z'+ updated_at: '2026-03-24T11:05:20.804Z'store_credit_total: '0.0'display_store_credit_total: "$0.00"gift_card_total: '0.0'@@ -1910,8 +1910,8 @@ paths:variant_id: variant_UkLWZg9DAJquantity: 1currency: USD- name: Product 83358- slug: product-83358+ name: Product 84404+ slug: product-84404options_text: ''price: '10.0'display_price: "$10.00"@@ -1930,21 +1930,21 @@ paths:discounted_amount: '10.0'display_discounted_amount: "$10.00"display_compare_at_amount: "$0.00"- created_at: '2026-03-23T09:46:58.186Z'- updated_at: '2026-03-23T09:46:58.186Z'+ created_at: '2026-03-24T11:05:20.785Z'+ updated_at: '2026-03-24T11:05:20.785Z'compare_at_amount:thumbnail_url:option_values: []digital_links: []fulfillments:- id: ful_UkLWZg9DAJ- number: H21726362583+ number: H72246124757tracking: U10000tracking_url:cost: '100.0'display_cost: "$100.00"- created_at: '2026-03-23T09:46:58.197Z'- updated_at: '2026-03-23T09:46:58.226Z'+ created_at: '2026-03-24T11:05:20.790Z'+ updated_at: '2026-03-24T11:05:20.802Z'status: pendingfulfillment_type: shippingfulfilled_at:@@ -1959,7 +1959,7 @@ paths:stock_location:id: sloc_UkLWZg9DAJstate_abbr: STATE_ABBR_52- name: Hubert Padberg+ name: Gaston Morissetteaddress1: 1600 Pennsylvania Ave NWcity: Washingtonzipcode: '20500'@@ -2083,8 +2083,8 @@ paths:application/json:example:id: or_UkLWZg9DAJ- number: R404139967- email: [email protected]+ number: R478053417+ email: [email protected]customer_note:currency: USDlocale: en@@ -2107,9 +2107,9 @@ paths:display_delivery_total: "$10.00"fulfillment_status: backorderpayment_status: paid- completed_at: '2026-03-23T09:46:59.646Z'- created_at: '2026-03-23T09:46:59.438Z'- updated_at: '2026-03-23T09:46:59.646Z'+ completed_at: '2026-03-24T11:05:22.264Z'+ created_at: '2026-03-24T11:05:22.027Z'+ updated_at: '2026-03-24T11:05:22.264Z'store_credit_total: '0.0'display_store_credit_total: "$0.00"gift_card_total: '0.0'@@ -2121,8 +2121,8 @@ paths:variant_id: variant_UkLWZg9DAJquantity: 1currency: USD- name: Product 105172- slug: product-105172+ name: Product 108977+ slug: product-108977options_text: ''price: '19.99'display_price: "$19.99"@@ -2141,21 +2141,21 @@ paths:discounted_amount: '19.99'display_discounted_amount: "$19.99"display_compare_at_amount: "$0.00"- created_at: '2026-03-23T09:46:59.466Z'- updated_at: '2026-03-23T09:46:59.650Z'+ created_at: '2026-03-24T11:05:22.063Z'+ updated_at: '2026-03-24T11:05:22.268Z'compare_at_amount:thumbnail_url:option_values: []digital_links: []fulfillments:- id: ful_gbHJdmfrXB- number: H64614779788+ number: H05796288500tracking:tracking_url:cost: '10.0'display_cost: "$10.00"- created_at: '2026-03-23T09:46:59.529Z'- updated_at: '2026-03-23T09:46:59.640Z'+ created_at: '2026-03-24T11:05:22.132Z'+ updated_at: '2026-03-24T11:05:22.256Z'status: pendingfulfillment_type: shippingfulfilled_at:@@ -2170,7 +2170,7 @@ paths:stock_location:id: sloc_UkLWZg9DAJstate_abbr: STATE_ABBR_58- name: Salena Stamm+ name: Barb Strackeaddress1: 1600 Pennsylvania Ave NWcity: Washingtonzipcode: '20500'@@ -2192,11 +2192,11 @@ paths:- id: py_UkLWZg9DAJpayment_method_id: pm_UkLWZg9DAJresponse_code: '12345'- number: P9RIMUKW+ number: PW4ZHL30amount: '29.99'display_amount: "$29.99"- created_at: '2026-03-23T09:46:59.598Z'- updated_at: '2026-03-23T09:46:59.622Z'+ created_at: '2026-03-24T11:05:22.202Z'+ updated_at: '2026-03-24T11:05:22.235Z'status: completedsource_type: credit_cardsource_id: card_UkLWZg9DAJ@@ -2334,8 +2334,8 @@ paths:meta_description:meta_keywords:children_count: 1- created_at: '2026-03-23T09:47:00.287Z'- updated_at: '2026-03-23T09:47:00.352Z'+ created_at: '2026-03-24T11:05:22.972Z'+ updated_at: '2026-03-24T11:05:23.046Z'parent_id:description: ''description_html: ''@@ -2353,8 +2353,8 @@ paths:meta_description:meta_keywords:children_count: 1- created_at: '2026-03-23T09:47:00.294Z'- updated_at: '2026-03-23T09:47:00.351Z'+ created_at: '2026-03-24T11:05:22.992Z'+ updated_at: '2026-03-24T11:05:23.045Z'parent_id: ctg_UkLWZg9DAJdescription: ''description_html: ''@@ -2372,8 +2372,8 @@ paths:meta_description:meta_keywords:children_count: 0- created_at: '2026-03-23T09:47:00.305Z'- updated_at: '2026-03-23T09:47:00.320Z'+ created_at: '2026-03-24T11:05:23.009Z'+ updated_at: '2026-03-24T11:05:23.016Z'parent_id: ctg_gbHJdmfrXBdescription: ''description_html: ''@@ -2474,8 +2474,8 @@ paths:meta_description:meta_keywords:children_count: 1- created_at: '2026-03-23T09:47:00.679Z'- updated_at: '2026-03-23T09:47:00.714Z'+ created_at: '2026-03-24T11:05:23.366Z'+ updated_at: '2026-03-24T11:05:23.402Z'parent_id: ctg_UkLWZg9DAJdescription: ''description_html: ''@@ -2602,28 +2602,28 @@ paths:example:data:- id: prod_UkLWZg9DAJ- name: Product 192296- slug: product-192296+ name: Product 194047+ slug: product-194047meta_description:meta_keywords:variant_count: 0- available_on: '2025-03-23T09:47:01.180Z'- created_at: '2026-03-23T09:47:01.195Z'- updated_at: '2026-03-23T09:47:01.209Z'+ available_on: '2025-03-24T11:05:23.867Z'+ created_at: '2026-03-24T11:05:23.890Z'+ updated_at: '2026-03-24T11:05:23.907Z'purchasable: truein_stock: falsebackorderable: trueavailable: true- description: Iure sequi deleniti quod illum quae. Vel perspiciatis- nobis aspernatur quae vitae quisquam officia. Aliquam non cupiditate- delectus cum. Provident debitis laborum illum consectetur ad aut- ducimus. Id repellendus repellat aliquid rerum necessitatibus- quae. Optio tempore quae itaque est perspiciatis illum tempora.- Aspernatur asperiores temporibus odit nostrum. Ipsam esse distinctio- reprehenderit perferendis laborum.- description_html: |-- Iure sequi deleniti quod illum quae. Vel perspiciatis nobis aspernatur quae vitae quisquam officia. Aliquam non cupiditate delectus cum.- Provident debitis laborum illum consectetur ad aut ducimus. Id repellendus repellat aliquid rerum necessitatibus quae. Optio tempore quae itaque est perspiciatis illum tempora. Aspernatur asperiores temporibus odit nostrum. Ipsam esse distinctio reprehenderit perferendis laborum.+ description: Voluptates repudiandae laboriosam expedita corrupti+ recusandae nostrum. Beatae voluptates ex consequatur dolorum voluptate+ mollitia. Deserunt ad pariatur quod nulla veniam aut beatae repudiandae.+ Iusto at deleniti fugiat a. Necessitatibus tenetur error facere+ mollitia nesciunt ea.+ description_html: Voluptates repudiandae laboriosam expedita corrupti+ recusandae nostrum. Beatae voluptates ex consequatur dolorum voluptate+ mollitia. Deserunt ad pariatur quod nulla veniam aut beatae repudiandae.+ Iusto at deleniti fugiat a. Necessitatibus tenetur error facere+ mollitia nesciunt ea.default_variant_id: variant_UkLWZg9DAJthumbnail_url:tags: []@@ -2889,9 +2889,9 @@ paths:application/json:example:id: cart_UkLWZg9DAJ- number: R004874374- token: uHE4ndiN88j6CekZ1323ESQAwFS5zeNk346- email: [email protected]+ number: R281157330+ token: 4YysmU2TzicFAg9rgQEtETLkeWgGGETQW94+ email: [email protected]customer_note:currency: USDlocale: en@@ -2912,8 +2912,8 @@ paths:display_total: "$110.00"delivery_total: '100.0'display_delivery_total: "$100.00"- created_at: '2026-03-23T09:47:02.958Z'- updated_at: '2026-03-23T09:47:03.078Z'+ created_at: '2026-03-24T11:05:25.759Z'+ updated_at: '2026-03-24T11:05:25.894Z'store_credit_total: '50.0'display_store_credit_total: "-$50.00"gift_card_total: '50.0'@@ -2929,8 +2929,8 @@ paths:variant_id: variant_UkLWZg9DAJquantity: 1currency: USD- name: Product 235612- slug: product-235612+ name: Product 235269+ slug: product-235269options_text: ''price: '10.0'display_price: "$10.00"@@ -2949,21 +2949,21 @@ paths:discounted_amount: '10.0'display_discounted_amount: "$10.00"display_compare_at_amount: "$0.00"- created_at: '2026-03-23T09:47:02.996Z'- updated_at: '2026-03-23T09:47:02.996Z'+ created_at: '2026-03-24T11:05:25.808Z'+ updated_at: '2026-03-24T11:05:25.808Z'compare_at_amount:thumbnail_url:option_values: []digital_links: []fulfillments:- id: ful_UkLWZg9DAJ- number: H19829172400+ number: H89141703013tracking: U10000tracking_url:cost: '100.0'display_cost: "$100.00"- created_at: '2026-03-23T09:47:03.005Z'- updated_at: '2026-03-23T09:47:03.020Z'+ created_at: '2026-03-24T11:05:25.816Z'+ updated_at: '2026-03-24T11:05:25.835Z'status: pendingfulfillment_type: shippingfulfilled_at:@@ -2978,7 +2978,7 @@ paths:stock_location:id: sloc_UkLWZg9DAJstate_abbr: STATE_ABBR_80- name: Delisa Hand+ name: Erlene Muelleraddress1: 1600 Pennsylvania Ave NWcity: Washingtonzipcode: '20500'@@ -2999,12 +2999,12 @@ paths:payments:- id: py_UkLWZg9DAJpayment_method_id: pm_UkLWZg9DAJ- response_code: 1-SC-20260323094703071904- number: P4R01X8M+ response_code: 1-SC-20260324110525886496+ number: PIF9V7HOamount: '50.0'display_amount: "$50.00"- created_at: '2026-03-23T09:47:03.073Z'- updated_at: '2026-03-23T09:47:03.073Z'+ created_at: '2026-03-24T11:05:25.888Z'+ updated_at: '2026-03-24T11:05:25.888Z'status: checkoutsource_type: store_creditsource_id: credit_UkLWZg9DAJ@@ -3083,8 +3083,8 @@ paths:redeemed_at:expired: falseactive: true- created_at: '2026-03-23T09:47:03.027Z'- updated_at: '2026-03-23T09:47:03.068Z'+ created_at: '2026-03-24T11:05:25.842Z'+ updated_at: '2026-03-24T11:05:25.882Z'schema:"$ref": "#/components/schemas/Cart"'422':@@ -3170,9 +3170,9 @@ paths:application/json:example:id: cart_UkLWZg9DAJ- number: R431828620- token: 2DJzZrUcqAGGVwYmsx7bJLLe21NedoVcvtE- email: [email protected]+ number: R560441265+ token: scZZXJHR2VsMLkQ5WkxeutNhzefxDBXqTuK+ email: [email protected]customer_note:currency: USDlocale: en@@ -3193,8 +3193,8 @@ paths:display_total: "$110.00"delivery_total: '100.0'display_delivery_total: "$100.00"- created_at: '2026-03-23T09:47:04.248Z'- updated_at: '2026-03-23T09:47:04.355Z'+ created_at: '2026-03-24T11:05:27.158Z'+ updated_at: '2026-03-24T11:05:27.271Z'store_credit_total: '0.0'display_store_credit_total: "$0.00"gift_card_total: '0.0'@@ -3213,8 +3213,8 @@ paths:variant_id: variant_UkLWZg9DAJquantity: 1currency: USD- name: Product 25249- slug: product-25249+ name: Product 25605+ slug: product-25605options_text: ''price: '10.0'display_price: "$10.00"@@ -3233,21 +3233,21 @@ paths:discounted_amount: '10.0'display_discounted_amount: "$10.00"display_compare_at_amount: "$0.00"- created_at: '2026-03-23T09:47:04.277Z'- updated_at: '2026-03-23T09:47:04.351Z'+ created_at: '2026-03-24T11:05:27.189Z'+ updated_at: '2026-03-24T11:05:27.266Z'compare_at_amount:thumbnail_url:option_values: []digital_links: []fulfillments:- id: ful_UkLWZg9DAJ- number: H67717632378+ number: H53091341637tracking: U10000tracking_url:cost: '100.0'display_cost: "$100.00"- created_at: '2026-03-23T09:47:04.283Z'- updated_at: '2026-03-23T09:47:04.297Z'+ created_at: '2026-03-24T11:05:27.194Z'+ updated_at: '2026-03-24T11:05:27.211Z'status: pendingfulfillment_type: shippingfulfilled_at:@@ -3262,7 +3262,7 @@ paths:stock_location:id: sloc_UkLWZg9DAJstate_abbr: STATE_ABBR_88- name: Tyesha Rolfson+ name: Micki Dachaddress1: 1600 Pennsylvania Ave NWcity: Washingtonzipcode: '20500'@@ -3733,17 +3733,17 @@ paths:content:application/json:example:- token: eyJhbGciOiJIUzI1NiJ9.eyJ1c2VyX2lkIjoxLCJ1c2VyX3R5cGUiOiJjdXN0b21lciIsImp0aSI6IjE2MTA1ODU1LWJjMzgtNDI5NC04N2NhLWEyZTMyNTQ2MzNiNyIsImlzcyI6InNwcmVlIiwiYXVkIjoic3RvcmVfYXBpIiwiZXhwIjoxNzc0MjYyODI5fQ.NWQMxgKBnCAOZFzRoBJvekMRaojc55DClkhFsIRN5sI- refresh_token: urfnTtVfZwYi7ETFdTZGqRsQ+ token: eyJhbGciOiJIUzI1NiJ9.eyJ1c2VyX2lkIjoxLCJ1c2VyX3R5cGUiOiJjdXN0b21lciIsImp0aSI6IjU5NDk1MmFmLTI5OTgtNDA4OC1hMTIzLWI2NGM1YzNjNjcxOSIsImlzcyI6InNwcmVlIiwiYXVkIjoic3RvcmVfYXBpIiwiZXhwIjoxNzc0MzUzOTMyfQ.NTCYCGiMW-npPp797iVA_WdTFTiNKSdxRyskm1h6xSg+ refresh_token: JmDfeJjU1rWK2uoYLdYooT5fuser:id: cus_UkLWZg9DAJemail: [email protected]- first_name: Dawn- last_name: Goyette+ first_name: Elnora+ last_name: Kirlinphone:accepts_email_marketing: false- created_at: '2026-03-23T09:47:09.182Z'- updated_at: '2026-03-23T09:47:09.456Z'+ created_at: '2026-03-24T11:05:32.150Z'+ updated_at: '2026-03-24T11:05:32.424Z'available_store_credit_total: '0'display_available_store_credit_total: "$0.00"addresses: []@@ -3833,8 +3833,8 @@ paths:example:data:- id: or_UkLWZg9DAJ- number: R254770538- email: [email protected]+ number: R016692819+ email: [email protected]customer_note:currency: USDlocale: en@@ -3857,9 +3857,9 @@ paths:display_delivery_total: "$100.00"fulfillment_status:payment_status:- completed_at: '2026-03-23T09:47:10.365Z'- created_at: '2026-03-23T09:47:10.313Z'- updated_at: '2026-03-23T09:47:10.364Z'+ completed_at: '2026-03-24T11:05:33.423Z'+ created_at: '2026-03-24T11:05:33.366Z'+ updated_at: '2026-03-24T11:05:33.423Z'store_credit_total: '0.0'display_store_credit_total: "$0.00"gift_card_total: '0.0'@@ -3871,8 +3871,8 @@ paths:variant_id: variant_UkLWZg9DAJquantity: 1currency: USD- name: Product 276107- slug: product-276107+ name: Product 274985+ slug: product-274985options_text: ''price: '10.0'display_price: "$10.00"@@ -3891,21 +3891,21 @@ paths:discounted_amount: '10.0'display_discounted_amount: "$10.00"display_compare_at_amount: "$0.00"- created_at: '2026-03-23T09:47:10.345Z'- updated_at: '2026-03-23T09:47:10.345Z'+ created_at: '2026-03-24T11:05:33.401Z'+ updated_at: '2026-03-24T11:05:33.401Z'compare_at_amount:thumbnail_url:option_values: []digital_links: []fulfillments:- id: ful_UkLWZg9DAJ- number: H26667211935+ number: H08038928226tracking: U10000tracking_url:cost: '100.0'display_cost: "$100.00"- created_at: '2026-03-23T09:47:10.350Z'- updated_at: '2026-03-23T09:47:10.362Z'+ created_at: '2026-03-24T11:05:33.407Z'+ updated_at: '2026-03-24T11:05:33.421Z'status: pendingfulfillment_type: shippingfulfilled_at:@@ -3920,7 +3920,7 @@ paths:stock_location:id: sloc_UkLWZg9DAJstate_abbr: STATE_ABBR_108- name: Brenton Spencer+ name: Thi Kuphaladdress1: 1600 Pennsylvania Ave NWcity: Washingtonzipcode: '20500'@@ -4045,8 +4045,8 @@ paths:application/json:example:id: or_UkLWZg9DAJ- number: R606321455- email: [email protected]+ number: R697251079+ email: [email protected]customer_note:currency: USDlocale: en@@ -4069,9 +4069,9 @@ paths:display_delivery_total: "$100.00"fulfillment_status:payment_status:- completed_at: '2026-03-23T09:47:11.085Z'- created_at: '2026-03-23T09:47:10.994Z'- updated_at: '2026-03-23T09:47:11.084Z'+ completed_at: '2026-03-24T11:05:34.122Z'+ created_at: '2026-03-24T11:05:34.066Z'+ updated_at: '2026-03-24T11:05:34.122Z'store_credit_total: '0.0'display_store_credit_total: "$0.00"gift_card_total: '0.0'@@ -4083,8 +4083,8 @@ paths:variant_id: variant_UkLWZg9DAJquantity: 1currency: USD- name: Product 293841- slug: product-293841+ name: Product 295564+ slug: product-295564options_text: ''price: '10.0'display_price: "$10.00"@@ -4103,21 +4103,21 @@ paths:discounted_amount: '10.0'display_discounted_amount: "$10.00"display_compare_at_amount: "$0.00"- created_at: '2026-03-23T09:47:11.021Z'- updated_at: '2026-03-23T09:47:11.021Z'+ created_at: '2026-03-24T11:05:34.099Z'+ updated_at: '2026-03-24T11:05:34.099Z'compare_at_amount:thumbnail_url:option_values: []digital_links: []fulfillments:- id: ful_UkLWZg9DAJ- number: H61254393961+ number: H09978577301tracking: U10000tracking_url:cost: '100.0'display_cost: "$100.00"- created_at: '2026-03-23T09:47:11.026Z'- updated_at: '2026-03-23T09:47:11.081Z'+ created_at: '2026-03-24T11:05:34.104Z'+ updated_at: '2026-03-24T11:05:34.119Z'status: pendingfulfillment_type: shippingfulfilled_at:@@ -4132,7 +4132,7 @@ paths:stock_location:id: sloc_UkLWZg9DAJstate_abbr: STATE_ABBR_114- name: Norma Dach+ name: Joane Lakinaddress1: 1600 Pennsylvania Ave NWcity: Washingtonzipcode: '20500'@@ -4243,8 +4243,8 @@ paths:content:application/json:example:- token: eyJhbGciOiJIUzI1NiJ9.eyJ1c2VyX2lkIjoxLCJ1c2VyX3R5cGUiOiJjdXN0b21lciIsImp0aSI6ImZjNjQyYWIzLTM1MmMtNGQwNS1hYjM3LTA5ODgxM2Q0NWFhNSIsImlzcyI6InNwcmVlIiwiYXVkIjoic3RvcmVfYXBpIiwiZXhwIjoxNzc0MjYyODMyfQ.JMgjcFXf4F_RXAn7G-vXS1fo59Lx5-Yi7WxyF6EoOXA- refresh_token: RGZzmJcRg6u8BShiiAP1cJnF+ token: eyJhbGciOiJIUzI1NiJ9.eyJ1c2VyX2lkIjoxLCJ1c2VyX3R5cGUiOiJjdXN0b21lciIsImp0aSI6ImJiYjY2NmY3LWU4OTYtNDFmYi04ZjA5LTdlYjQ5YzAxM2M4NCIsImlzcyI6InNwcmVlIiwiYXVkIjoic3RvcmVfYXBpIiwiZXhwIjoxNzc0MzUzOTM1fQ.L4lU7hiteKNR8CNkCt9lmn_ozJCwuyWniR_8vGUB7mI+ refresh_token: UJeZ1JvJabaJMcDQmGES6Thyuser:id: cus_UkLWZg9DAJemail: [email protected]@@ -4252,8 +4252,8 @@ paths:last_name: Doephone: "+1234567890"accepts_email_marketing: true- created_at: '2026-03-23T09:47:12.285Z'- updated_at: '2026-03-23T09:47:12.285Z'+ created_at: '2026-03-24T11:05:35.309Z'+ updated_at: '2026-03-24T11:05:35.309Z'available_store_credit_total: '0'display_available_store_credit_total: "$0.00"addresses: []@@ -4359,13 +4359,13 @@ paths:application/json:example:id: cus_UkLWZg9DAJ- email: [email protected]- first_name: Vannessa- last_name: Crona+ email: [email protected]+ first_name: Iris+ last_name: Wolfphone: 555-555-0199accepts_email_marketing: false- created_at: '2026-03-23T09:47:12.839Z'- updated_at: '2026-03-23T09:47:13.107Z'+ created_at: '2026-03-24T11:05:35.869Z'+ updated_at: '2026-03-24T11:05:36.138Z'available_store_credit_total: '0'display_available_store_credit_total: "$0.00"addresses:@@ -4499,13 +4499,13 @@ paths:application/json:example:id: cus_UkLWZg9DAJ- email: [email protected]+ email: [email protected]first_name: Updatedlast_name: Namephone: 555-555-0199accepts_email_marketing: false- created_at: '2026-03-23T09:47:13.405Z'- updated_at: '2026-03-23T09:47:13.684Z'+ created_at: '2026-03-24T11:05:36.432Z'+ updated_at: '2026-03-24T11:05:36.716Z'available_store_credit_total: '0'display_available_store_credit_total: "$0.00"addresses:@@ -4742,9 +4742,9 @@ paths:application/json:example:id: cart_UkLWZg9DAJ- number: R444840980- token: rL7tn53w1EaUofuk5W9hhB5NVToiSE31GQX- email: [email protected]+ number: R047761878+ token: fajNJ8dpN5cfSfio6mVpxVy9hp4GGxrKBUW+ email: [email protected]customer_note:currency: USDlocale: en@@ -4765,8 +4765,8 @@ paths:display_total: "$110.00"delivery_total: '100.0'display_delivery_total: "$100.00"- created_at: '2026-03-23T09:47:16.750Z'- updated_at: '2026-03-23T09:47:16.844Z'+ created_at: '2026-03-24T11:05:39.811Z'+ updated_at: '2026-03-24T11:05:39.904Z'store_credit_total: '0.0'display_store_credit_total: "$0.00"gift_card_total: '0.0'@@ -4787,8 +4787,8 @@ paths:variant_id: variant_UkLWZg9DAJquantity: 1currency: USD- name: Product 377282- slug: product-377282+ name: Product 375290+ slug: product-375290options_text: ''price: '10.0'display_price: "$10.00"@@ -4807,21 +4807,21 @@ paths:discounted_amount: '10.0'display_discounted_amount: "$10.00"display_compare_at_amount: "$0.00"- created_at: '2026-03-23T09:47:16.784Z'- updated_at: '2026-03-23T09:47:16.784Z'+ created_at: '2026-03-24T11:05:39.840Z'+ updated_at: '2026-03-24T11:05:39.840Z'compare_at_amount:thumbnail_url:option_values: []digital_links: []fulfillments:- id: ful_UkLWZg9DAJ- number: H46622685174+ number: H84190806434tracking: U10000tracking_url:cost: '100.0'display_cost: "$100.00"- created_at: '2026-03-23T09:47:16.789Z'- updated_at: '2026-03-23T09:47:16.828Z'+ created_at: '2026-03-24T11:05:39.846Z'+ updated_at: '2026-03-24T11:05:39.888Z'status: pendingfulfillment_type: shippingfulfilled_at:@@ -4836,7 +4836,7 @@ paths:stock_location:id: sloc_UkLWZg9DAJstate_abbr: STATE_ABBR_140- name: Marissa Rath+ name: Bettyann Ritchieaddress1: 1600 Pennsylvania Ave NWcity: Washingtonzipcode: '20500'@@ -4978,7 +4978,7 @@ paths:example:data:- id: gc_UkLWZg9DAJ- code: 98DA85C8DB495316+ code: 326E3E272A33064Cstatus: activecurrency: USDamount: '10.0'@@ -4992,8 +4992,8 @@ paths:redeemed_at:expired: falseactive: true- created_at: '2026-03-23T09:47:18.008Z'- updated_at: '2026-03-23T09:47:18.008Z'+ created_at: '2026-03-24T11:05:41.112Z'+ updated_at: '2026-03-24T11:05:41.112Z'meta:page: 1limit: 25@@ -5076,7 +5076,7 @@ paths:application/json:example:id: gc_UkLWZg9DAJ- code: 57D176FBE4A32D55+ code: '0902CC79EBEB527E'status: activecurrency: USDamount: '10.0'@@ -5090,8 +5090,8 @@ paths:redeemed_at:expired: falseactive: true- created_at: '2026-03-23T09:47:19.103Z'- updated_at: '2026-03-23T09:47:19.103Z'+ created_at: '2026-03-24T11:05:42.365Z'+ updated_at: '2026-03-24T11:05:42.365Z'schema:"$ref": "#/components/schemas/GiftCard"'404':@@ -5168,9 +5168,9 @@ paths:application/json:example:id: cart_UkLWZg9DAJ- number: R463847027- token: JKifDG2NJvTEspfKeY4Fer1tebB7ujYBjXa- email: [email protected]+ number: R326124229+ token: UXe2dok7BoQuw4VYCE4BseTALv6sZ5QHN2y+ email: [email protected]customer_note:currency: USDlocale: en@@ -5191,8 +5191,8 @@ paths:display_total: "$29.99"delivery_total: '0.0'display_delivery_total: "$0.00"- created_at: '2026-03-23T09:47:20.884Z'- updated_at: '2026-03-23T09:47:20.976Z'+ created_at: '2026-03-24T11:05:44.130Z'+ updated_at: '2026-03-24T11:05:44.270Z'store_credit_total: '0.0'display_store_credit_total: "$0.00"gift_card_total: '0.0'@@ -5217,8 +5217,8 @@ paths:variant_id: variant_UkLWZg9DAJquantity: 1currency: USD- name: Product 413923- slug: product-413923+ name: Product 41958+ slug: product-41958options_text: ''price: '10.0'display_price: "$10.00"@@ -5237,8 +5237,8 @@ paths:discounted_amount: '10.0'display_discounted_amount: "$10.00"display_compare_at_amount: "$0.00"- created_at: '2026-03-23T09:47:20.913Z'- updated_at: '2026-03-23T09:47:20.913Z'+ created_at: '2026-03-24T11:05:44.163Z'+ updated_at: '2026-03-24T11:05:44.163Z'compare_at_amount:thumbnail_url:option_values: []@@ -5247,8 +5247,8 @@ paths:variant_id: variant_gbHJdmfrXBquantity: 1currency: USD- name: Product 424356- slug: product-424356+ name: Product 427386+ slug: product-427386options_text: ''price: '19.99'display_price: "$19.99"@@ -5267,8 +5267,8 @@ paths:discounted_amount: '19.99'display_discounted_amount: "$19.99"display_compare_at_amount: "$0.00"- created_at: '2026-03-23T09:47:20.953Z'- updated_at: '2026-03-23T09:47:20.953Z'+ created_at: '2026-03-24T11:05:44.226Z'+ updated_at: '2026-03-24T11:05:44.226Z'compare_at_amount:thumbnail_url:option_values: []@@ -5391,9 +5391,9 @@ paths:application/json:example:id: cart_UkLWZg9DAJ- number: R147829283- token: tx28arHAUqPamcnvuSsd1umbp5rqm2QLjb4- email: [email protected]+ number: R535839457+ token: BsfybRDzVD69NciUBAmffg9P2v4bxpbPNup+ email: [email protected]customer_note:currency: USDlocale: en@@ -5414,8 +5414,8 @@ paths:display_total: "$0.00"delivery_total: '0.0'display_delivery_total: "$0.00"- created_at: '2026-03-23T09:47:22.737Z'- updated_at: '2026-03-23T09:47:22.767Z'+ created_at: '2026-03-24T11:05:46.075Z'+ updated_at: '2026-03-24T11:05:46.106Z'store_credit_total: '0.0'display_store_credit_total: "$0.00"gift_card_total: '0.0'@@ -5437,8 +5437,8 @@ paths:variant_id: variant_UkLWZg9DAJquantity: 1currency: USD- name: Product 452092- slug: product-452092+ name: Product 454984+ slug: product-454984options_text: ''price: '10.0'display_price: "$10.00"@@ -5457,8 +5457,8 @@ paths:discounted_amount: '10.0'display_discounted_amount: "$10.00"display_compare_at_amount: "$0.00"- created_at: '2026-03-23T09:47:22.766Z'- updated_at: '2026-03-23T09:47:22.785Z'+ created_at: '2026-03-24T11:05:46.106Z'+ updated_at: '2026-03-24T11:05:46.121Z'compare_at_amount:thumbnail_url:option_values: []@@ -5561,9 +5561,9 @@ paths:application/json:example:id: cart_UkLWZg9DAJ- number: R745050318- token: 5KWHoMmKxnJWXqcRunWkgTYwweX9m1QRdyt- email: [email protected]+ number: R756386841+ token: JysS9GAKxVk6hMPVuhsRCGJxrV7GLFQ7HjD+ email: [email protected]customer_note:currency: USDlocale: en@@ -5584,8 +5584,8 @@ paths:display_total: "$0.00"delivery_total: '0.0'display_delivery_total: "$0.00"- created_at: '2026-03-23T09:47:23.331Z'- updated_at: '2026-03-23T09:47:23.380Z'+ created_at: '2026-03-24T11:05:46.665Z'+ updated_at: '2026-03-24T11:05:46.720Z'store_credit_total: '0.0'display_store_credit_total: "$0.00"gift_card_total: '0.0'@@ -6146,7 +6146,7 @@ paths:application/json:example:id: or_UkLWZg9DAJ- number: R250122845+ number: R128727515email: [email protected]customer_note:currency: USD@@ -6170,9 +6170,9 @@ paths:display_delivery_total: "$100.00"fulfillment_status:payment_status:- completed_at: '2026-03-23T09:47:25.170Z'- created_at: '2026-03-23T09:47:25.119Z'- updated_at: '2026-03-23T09:47:25.169Z'+ completed_at: '2026-03-24T11:05:48.460Z'+ created_at: '2026-03-24T11:05:48.405Z'+ updated_at: '2026-03-24T11:05:48.460Z'store_credit_total: '0.0'display_store_credit_total: "$0.00"gift_card_total: '0.0'@@ -6184,8 +6184,8 @@ paths:variant_id: variant_UkLWZg9DAJquantity: 1currency: USD- name: Product 494345- slug: product-494345+ name: Product 493300+ slug: product-493300options_text: ''price: '10.0'display_price: "$10.00"@@ -6204,21 +6204,21 @@ paths:discounted_amount: '10.0'display_discounted_amount: "$10.00"display_compare_at_amount: "$0.00"- created_at: '2026-03-23T09:47:25.149Z'- updated_at: '2026-03-23T09:47:25.149Z'+ created_at: '2026-03-24T11:05:48.438Z'+ updated_at: '2026-03-24T11:05:48.438Z'compare_at_amount:thumbnail_url:option_values: []digital_links: []fulfillments:- id: ful_UkLWZg9DAJ- number: H51462799105+ number: H32448688287tracking: U10000tracking_url:cost: '100.0'display_cost: "$100.00"- created_at: '2026-03-23T09:47:25.154Z'- updated_at: '2026-03-23T09:47:25.167Z'+ created_at: '2026-03-24T11:05:48.443Z'+ updated_at: '2026-03-24T11:05:48.458Z'status: pendingfulfillment_type: shippingfulfilled_at:@@ -6233,7 +6233,7 @@ paths:stock_location:id: sloc_UkLWZg9DAJstate_abbr: STATE_ABBR_181- name: Vanessa Lesch+ name: Gemma Kirlinaddress1: 1600 Pennsylvania Ave NWcity: Washingtonzipcode: '20500'@@ -6369,13 +6369,13 @@ paths:id: ps_gbHJdmfrXBstatus: pendingcurrency: USD- external_id: bogus_e00ccbc044e5e86289394e0b+ external_id: bogus_067bd59e2cd318af3d19669eexternal_data:- client_secret: bogus_secret_e8e38c0d137eae1f+ client_secret: bogus_secret_53dcbe8ec43304c5customer_external_id:expires_at:- created_at: '2026-03-23T09:47:26.976Z'- updated_at: '2026-03-23T09:47:26.976Z'+ created_at: '2026-03-24T11:05:50.302Z'+ updated_at: '2026-03-24T11:05:50.302Z'amount: '110.0'payment_method_id: pm_UkLWZg9DAJorder_id: or_UkLWZg9DAJ@@ -6470,13 +6470,13 @@ paths:id: ps_UkLWZg9DAJstatus: pendingcurrency: USD- external_id: bogus_74db71a772f1832dacb652c7+ external_id: bogus_87a78956dcdbba5ff78940beexternal_data:client_secret: secret_123customer_external_id:expires_at:- created_at: '2026-03-23T09:47:27.576Z'- updated_at: '2026-03-23T09:47:27.576Z'+ created_at: '2026-03-24T11:05:50.916Z'+ updated_at: '2026-03-24T11:05:50.916Z'amount: '110.0'payment_method_id: pm_UkLWZg9DAJorder_id: or_UkLWZg9DAJ@@ -6533,13 +6533,13 @@ paths:id: ps_UkLWZg9DAJstatus: pendingcurrency: USD- external_id: bogus_905ffa9d1f4fc50b54d8dc63+ external_id: bogus_a8bf0622b05c10f35154438aexternal_data:client_secret: secret_123customer_external_id:expires_at:- created_at: '2026-03-23T09:47:28.787Z'- updated_at: '2026-03-23T09:47:28.802Z'+ created_at: '2026-03-24T11:05:52.145Z'+ updated_at: '2026-03-24T11:05:52.157Z'amount: '50.0'payment_method_id: pm_UkLWZg9DAJorder_id: or_UkLWZg9DAJ@@ -6636,13 +6636,13 @@ paths:id: ps_UkLWZg9DAJstatus: completedcurrency: USD- external_id: bogus_1203eaa7dad2d1565f80dfe9+ external_id: bogus_ad4f57c22e579bdd5f4836dbexternal_data:client_secret: secret_123customer_external_id:expires_at:- created_at: '2026-03-23T09:47:29.413Z'- updated_at: '2026-03-23T09:47:29.426Z'+ created_at: '2026-03-24T11:05:52.789Z'+ updated_at: '2026-03-24T11:05:52.813Z'amount: '110.0'payment_method_id: pm_UkLWZg9DAJorder_id: or_UkLWZg9DAJ@@ -6722,11 +6722,11 @@ paths:example:id: pss_gbHJdmfrXBstatus: pending- external_id: bogus_seti_a3217c4fd5589f6395a5c1a7- external_client_secret: bogus_seti_secret_c66ed8871765fd18+ external_id: bogus_seti_6d01a0cb5e3d1e9e64a51691+ external_client_secret: bogus_seti_secret_c4688e8684e7a485external_data: {}- created_at: '2026-03-23T09:47:30.605Z'- updated_at: '2026-03-23T09:47:30.605Z'+ created_at: '2026-03-24T11:05:54.041Z'+ updated_at: '2026-03-24T11:05:54.041Z'payment_method_id: pm_UkLWZg9DAJpayment_source_id:payment_source_type:@@ -6823,12 +6823,12 @@ paths:example:id: pss_UkLWZg9DAJstatus: pending- external_id: seti_test_e3bf7e5234e5919f94846c90- external_client_secret: seti_secret_2ff694ec33af213a26c7684e+ external_id: seti_test_405964e605f0f7cad98f7023+ external_client_secret: seti_secret_8d391a059642300a37c5bedfexternal_data:client_secret: secret_123- created_at: '2026-03-23T09:47:32.259Z'- updated_at: '2026-03-23T09:47:32.259Z'+ created_at: '2026-03-24T11:05:55.679Z'+ updated_at: '2026-03-24T11:05:55.679Z'payment_method_id: pm_UkLWZg9DAJpayment_source_id:payment_source_type:@@ -6901,12 +6901,12 @@ paths:example:id: pss_UkLWZg9DAJstatus: completed- external_id: seti_test_75805f2d27b094d5f08a02f6- external_client_secret: seti_secret_770ce0b2607313ae9074ef6e+ external_id: seti_test_125f77851299a5f4612b564c+ external_client_secret: seti_secret_b85bb39905f17d5a3c95f461external_data:client_secret: secret_123- created_at: '2026-03-23T09:47:33.372Z'- updated_at: '2026-03-23T09:47:33.384Z'+ created_at: '2026-03-24T11:05:56.781Z'+ updated_at: '2026-03-24T11:05:56.793Z'payment_method_id: pm_UkLWZg9DAJpayment_source_id: card_UkLWZg9DAJpayment_source_type: Spree::CreditCard@@ -6997,11 +6997,11 @@ paths:id: py_UkLWZg9DAJpayment_method_id: pm_UkLWZg9DAJresponse_code:- number: PUATWDMA+ number: P3DUDCFZamount: '110.0'display_amount: "$110.00"- created_at: '2026-03-23T09:47:34.576Z'- updated_at: '2026-03-23T09:47:34.576Z'+ created_at: '2026-03-24T11:05:58.054Z'+ updated_at: '2026-03-24T11:05:58.054Z'status: checkoutsource_type:source_id:@@ -7159,14 +7159,14 @@ paths:example:data:- id: prod_UkLWZg9DAJ- name: Product 598781- slug: product-598781+ name: Product 59391+ slug: product-59391meta_description:meta_keywords:variant_count: 1- available_on: '2025-03-23T09:47:35.225Z'- created_at: '2026-03-23T09:47:35.237Z'- updated_at: '2026-03-23T09:47:35.278Z'+ available_on: '2025-03-24T11:05:58.728Z'+ created_at: '2026-03-24T11:05:58.743Z'+ updated_at: '2026-03-24T11:05:58.790Z'purchasable: truein_stock: falsebackorderable: true@@ -7188,24 +7188,36 @@ paths:price_list_id:original_price:- id: prod_gbHJdmfrXB- name: Product 607832- slug: product-607832+ name: Product 602924+ slug: product-602924meta_description:meta_keywords:variant_count: 0- available_on: '2025-03-23T09:47:35.283Z'- created_at: '2026-03-23T09:47:35.292Z'- updated_at: '2026-03-23T09:47:35.303Z'+ available_on: '2025-03-24T11:05:58.795Z'+ created_at: '2026-03-24T11:05:58.805Z'+ updated_at: '2026-03-24T11:05:58.819Z'purchasable: truein_stock: falsebackorderable: trueavailable: true- description: Aut eos dolores vel earum quos ducimus. Exercitationem- inventore numquam culpa consequatur nesciunt. Sapiente vero quas- assumenda nisi.- description_html: Aut eos dolores vel earum quos ducimus. Exercitationem- inventore numquam culpa consequatur nesciunt. Sapiente vero quas- assumenda nisi.+ description: Quisquam repudiandae aut natus recusandae laudantium+ impedit dolore veniam. Reprehenderit vero cumque voluptate laboriosam.+ Dolorum a labore sunt temporibus in. Adipisci minus illo aperiam+ minima alias. Inventore iste accusamus repellendus velit a aliquid+ nisi. Excepturi suscipit voluptates quaerat ullam nisi exercitationem.+ Minus magni velit temporibus ullam. Possimus quam dolorem adipisci+ voluptatum. Laudantium placeat perspiciatis error id cumque. Expedita+ magni illum architecto numquam esse. Et voluptates blanditiis+ illo cupiditate similique omnis neque facere. Corrupti rerum aut+ alias exercitationem fugit illo possimus perspiciatis. Earum temporibus+ soluta ducimus repellendus velit ipsam aspernatur. Facere totam+ numquam vitae tenetur suscipit nisi. Optio quam incidunt praesentium+ voluptatum libero commodi iusto eum.+ description_html: |-+ Quisquam repudiandae aut natus recusandae laudantium impedit dolore veniam. Reprehenderit vero cumque voluptate laboriosam. Dolorum a labore sunt temporibus in.+ Adipisci minus illo aperiam minima alias. Inventore iste accusamus repellendus velit a aliquid nisi. Excepturi suscipit voluptates quaerat ullam nisi exercitationem. Minus magni velit temporibus ullam.+ Possimus quam dolorem adipisci voluptatum. Laudantium placeat perspiciatis error id cumque. Expedita magni illum architecto numquam esse. Et voluptates blanditiis illo cupiditate similique omnis neque facere.+ Corrupti rerum aut alias exercitationem fugit illo possimus perspiciatis. Earum temporibus soluta ducimus repellendus velit ipsam aspernatur. Facere totam numquam vitae tenetur suscipit nisi. Optio quam incidunt praesentium voluptatum libero commodi iusto eum.default_variant_id: variant_EfhxLZ9ck8thumbnail_url:tags: []@@ -7302,19 +7314,19 @@ paths:type: stringresponses:'200':- description: product found by prefix ID+ description: product without prior_price expanded does not include fieldcontent:application/json:example:id: prod_UkLWZg9DAJ- name: Product 714311- slug: product-714311+ name: Product 873511+ slug: product-873511meta_description:meta_keywords:variant_count: 1- available_on: '2025-03-23T09:47:35.850Z'- created_at: '2026-03-23T09:47:35.864Z'- updated_at: '2026-03-23T09:47:35.897Z'+ available_on: '2025-03-24T11:06:00.369Z'+ created_at: '2026-03-24T11:06:00.384Z'+ updated_at: '2026-03-24T11:06:00.420Z'purchasable: truein_stock: falsebackorderable: true@@ -7335,6 +7347,13 @@ paths:display_compare_at_amount:price_list_id:original_price:+ prior_price:+ id: _AXs1igzRC6+ amount: '9.99'+ amount_in_cents: 999+ currency: USD+ display_amount: "$9.99"+ recorded_at: '2026-03-09T11:06:00Z'schema:"$ref": "#/components/schemas/Product"'404':@@ -7427,7 +7446,7 @@ paths:options:- id: ctg_EfhxLZ9ck8name: Shirts- permalink: taxonomy-29/taxon-39/shirts+ permalink: taxonomy-31/taxon-41/shirtscount: 2sort_options:- id: manual@@ -7705,9 +7724,9 @@ paths:application/json:example:id: cart_UkLWZg9DAJ- number: R456929816- token: x3ELcyvNAYUFmoXStUaRuALXebhvTRFKAMu- email: [email protected]+ number: R943357454+ token: jmNR2nMZZZSXi9xHbhvHtGn6r6XKFyq6Z6t+ email: [email protected]customer_note:currency: USDlocale: en@@ -7728,8 +7747,8 @@ paths:display_total: "$110.00"delivery_total: '100.0'display_delivery_total: "$100.00"- created_at: '2026-03-23T09:47:41.084Z'- updated_at: '2026-03-23T09:47:41.154Z'+ created_at: '2026-03-24T11:06:05.291Z'+ updated_at: '2026-03-24T11:06:05.337Z'store_credit_total: '10.0'display_store_credit_total: "-$10.00"gift_card_total: '0.0'@@ -7745,8 +7764,8 @@ paths:variant_id: variant_UkLWZg9DAJquantity: 1currency: USD- name: Product 995483- slug: product-995483+ name: Product 1072461+ slug: product-1072461options_text: ''price: '10.0'display_price: "$10.00"@@ -7765,21 +7784,21 @@ paths:discounted_amount: '10.0'display_discounted_amount: "$10.00"display_compare_at_amount: "$0.00"- created_at: '2026-03-23T09:47:41.128Z'- updated_at: '2026-03-23T09:47:41.128Z'+ created_at: '2026-03-24T11:06:05.318Z'+ updated_at: '2026-03-24T11:06:05.318Z'compare_at_amount:thumbnail_url:option_values: []digital_links: []fulfillments:- id: ful_UkLWZg9DAJ- number: H01423259125+ number: H46724419728tracking: U10000tracking_url:cost: '100.0'display_cost: "$100.00"- created_at: '2026-03-23T09:47:41.134Z'- updated_at: '2026-03-23T09:47:41.151Z'+ created_at: '2026-03-24T11:06:05.323Z'+ updated_at: '2026-03-24T11:06:05.335Z'status: pendingfulfillment_type: shippingfulfilled_at:@@ -7793,14 +7812,14 @@ paths:code: UPS_GROUNDstock_location:id: sloc_UkLWZg9DAJ- state_abbr: STATE_ABBR_253- name: Tiana Kreiger+ state_abbr: STATE_ABBR_255+ name: Rene Lynchaddress1: 1600 Pennsylvania Ave NWcity: Washingtonzipcode: '20500'country_iso: UScountry_name: United States of America- state_text: STATE_ABBR_253+ state_text: STATE_ABBR_255delivery_rates:- id: dr_UkLWZg9DAJdelivery_method_id: dm_UkLWZg9DAJ@@ -7815,12 +7834,12 @@ paths:payments:- id: py_UkLWZg9DAJpayment_method_id: pm_UkLWZg9DAJ- response_code: 1-SC-20260323094741443566- number: P9DA8LE0+ response_code: 1-SC-20260324110605630576+ number: P1BUJWVDamount: '10.0'display_amount: "$10.00"- created_at: '2026-03-23T09:47:41.447Z'- updated_at: '2026-03-23T09:47:41.447Z'+ created_at: '2026-03-24T11:06:05.633Z'+ updated_at: '2026-03-24T11:06:05.633Z'status: checkoutsource_type: store_creditsource_id: credit_UkLWZg9DAJ@@ -7852,12 +7871,12 @@ paths:company: Companycountry_name: United States of Americacountry_iso: US- state_text: STATE_ABBR_255- state_abbr: STATE_ABBR_255+ state_text: STATE_ABBR_257+ state_abbr: STATE_ABBR_257quick_checkout: falseis_default_billing: falseis_default_shipping: false- state_name: STATE_NAME_255+ state_name: STATE_NAME_257shipping_address:id: addr_VqXmZF31wYfirst_name: John@@ -7871,12 +7890,12 @@ paths:company: Companycountry_name: United States of Americacountry_iso: US- state_text: STATE_ABBR_256- state_abbr: STATE_ABBR_256+ state_text: STATE_ABBR_258+ state_abbr: STATE_ABBR_258quick_checkout: falseis_default_billing: falseis_default_shipping: false- state_name: STATE_NAME_256+ state_name: STATE_NAME_258payment_methods:- id: pm_UkLWZg9DAJname: Store Credit@@ -7957,9 +7976,9 @@ paths:application/json:example:id: cart_UkLWZg9DAJ- number: R125138351- token: u5cMB6zXAHAKJwXmhnQVvWWjgaYWiw47cSr- email: [email protected]+ number: R223600924+ token: KiRS8iuhHyuqQwXUsTbnVa2F1mH3VL74NXW+ email: [email protected]customer_note:currency: USDlocale: en@@ -7980,8 +7999,8 @@ paths:display_total: "$110.00"delivery_total: '100.0'display_delivery_total: "$100.00"- created_at: '2026-03-23T09:47:42.634Z'- updated_at: '2026-03-23T09:47:42.686Z'+ created_at: '2026-03-24T11:06:06.816Z'+ updated_at: '2026-03-24T11:06:06.864Z'store_credit_total: '0.0'display_store_credit_total: "$0.00"gift_card_total: '0.0'@@ -8000,8 +8019,8 @@ paths:variant_id: variant_UkLWZg9DAJquantity: 1currency: USD- name: Product 1017022- slug: product-1017022+ name: Product 1092250+ slug: product-1092250options_text: ''price: '10.0'display_price: "$10.00"@@ -8020,21 +8039,21 @@ paths:discounted_amount: '10.0'display_discounted_amount: "$10.00"display_compare_at_amount: "$0.00"- created_at: '2026-03-23T09:47:42.664Z'- updated_at: '2026-03-23T09:47:42.664Z'+ created_at: '2026-03-24T11:06:06.845Z'+ updated_at: '2026-03-24T11:06:06.845Z'compare_at_amount:thumbnail_url:option_values: []digital_links: []fulfillments:- id: ful_UkLWZg9DAJ- number: H35778067784+ number: H39852890219tracking: U10000tracking_url:cost: '100.0'display_cost: "$100.00"- created_at: '2026-03-23T09:47:42.670Z'- updated_at: '2026-03-23T09:47:42.683Z'+ created_at: '2026-03-24T11:06:06.849Z'+ updated_at: '2026-03-24T11:06:06.862Z'status: pendingfulfillment_type: shippingfulfilled_at:@@ -8048,14 +8067,14 @@ paths:code: UPS_GROUNDstock_location:id: sloc_UkLWZg9DAJ- state_abbr: STATE_ABBR_261- name: Morton Barrows+ state_abbr: STATE_ABBR_263+ name: Yuk Gibsonaddress1: 1600 Pennsylvania Ave NWcity: Washingtonzipcode: '20500'country_iso: UScountry_name: United States of America- state_text: STATE_ABBR_261+ state_text: STATE_ABBR_263delivery_rates:- id: dr_UkLWZg9DAJdelivery_method_id: dm_UkLWZg9DAJ@@ -8081,12 +8100,12 @@ paths:company: Companycountry_name: United States of Americacountry_iso: US- state_text: STATE_ABBR_263- state_abbr: STATE_ABBR_263+ state_text: STATE_ABBR_265+ state_abbr: STATE_ABBR_265quick_checkout: falseis_default_billing: falseis_default_shipping: false- state_name: STATE_NAME_263+ state_name: STATE_NAME_265shipping_address:id: addr_VqXmZF31wYfirst_name: John@@ -8100,12 +8119,12 @@ paths:company: Companycountry_name: United States of Americacountry_iso: US- state_text: STATE_ABBR_264- state_abbr: STATE_ABBR_264+ state_text: STATE_ABBR_266+ state_abbr: STATE_ABBR_266quick_checkout: falseis_default_billing: falseis_default_shipping: false- state_name: STATE_NAME_264+ state_name: STATE_NAME_266payment_methods: []gift_card:schema:@@ -8170,9 +8189,9 @@ paths:data:- id: wl_UkLWZg9DAJname: My Wishlist- token: HcmzwPy6ZykCsCXQAKzsUbZ3- created_at: '2026-03-23T09:47:43.258Z'- updated_at: '2026-03-23T09:47:43.258Z'+ token: cAWj8qUcWi2shxzhec4Usn3i+ created_at: '2026-03-24T11:06:07.446Z'+ updated_at: '2026-03-24T11:06:07.446Z'is_default: falseis_private: truemeta:@@ -8248,9 +8267,9 @@ paths:example:id: wl_gbHJdmfrXBname: Birthday Ideas- token: W3gCY6dcqoqXaW5TVrYihQYQ- created_at: '2026-03-23T09:47:44.460Z'- updated_at: '2026-03-23T09:47:44.460Z'+ token: f3YJ8WfGKobeaEiwoSLfsRFJ+ created_at: '2026-03-24T11:06:08.645Z'+ updated_at: '2026-03-24T11:06:08.645Z'is_default: falseis_private: trueschema:@@ -8346,9 +8365,9 @@ paths:example:id: wl_UkLWZg9DAJname: My Wishlist- token: ZcKczuWt69M5SGyn9zneXbfS- created_at: '2026-03-23T09:47:45.582Z'- updated_at: '2026-03-23T09:47:45.582Z'+ token: ZtcVF65692MDpfJjiJ6uCDQo+ created_at: '2026-03-24T11:06:09.759Z'+ updated_at: '2026-03-24T11:06:09.759Z'is_default: falseis_private: trueschema:@@ -8410,9 +8429,9 @@ paths:example:id: wl_UkLWZg9DAJname: Updated Name- token: yheHzdKp69kba6YGxCNsGdXm- created_at: '2026-03-23T09:47:46.748Z'- updated_at: '2026-03-23T09:47:46.788Z'+ token: 3UejRiQSyCDQPYwbWUWAh5rF+ created_at: '2026-03-24T11:06:10.902Z'+ updated_at: '2026-03-24T11:06:10.954Z'is_default: falseis_private: trueschema:@@ -8524,17 +8543,17 @@ paths:variant_id: variant_gbHJdmfrXBwishlist_id: wl_UkLWZg9DAJquantity: 1- created_at: '2026-03-23T09:47:47.987Z'- updated_at: '2026-03-23T09:47:47.987Z'+ created_at: '2026-03-24T11:06:12.139Z'+ updated_at: '2026-03-24T11:06:12.139Z'variant:id: variant_gbHJdmfrXBproduct_id: prod_gbHJdmfrXB- sku: SKU-121+ sku: SKU-131options_text: ''track_inventory: truemedia_count: 0- created_at: '2026-03-23T09:47:47.962Z'- updated_at: '2026-03-23T09:47:47.973Z'+ created_at: '2026-03-24T11:06:12.113Z'+ updated_at: '2026-03-24T11:06:12.123Z'thumbnail_url:purchasable: truein_stock: false@@ -10232,6 +10251,29 @@ components:- id- gateway_payment_profile_idx-typelizer: true+ PriceHistory:+ type: object+ properties:+ id:+ type: string+ amount:+ type: string+ amount_in_cents:+ type: number+ currency:+ type: string+ display_amount:+ type: string+ recorded_at:+ type: string+ required:+ - id+ - amount+ - amount_in_cents+ - currency+ - display_amount+ - recorded_at+ x-typelizer: truePrice:type: objectproperties:@@ -10349,6 +10391,10 @@ components:type: arrayitems:"$ref": "#/components/schemas/Metafield"+ prior_price:+ allOf:+ - "$ref": "#/components/schemas/PriceHistory"+ nullable: truerequired:- id- name@@ -10650,6 +10696,10 @@ components:type: arrayitems:"$ref": "#/components/schemas/Metafield"+ prior_price:+ allOf:+ - "$ref": "#/components/schemas/PriceHistory"+ nullable: truerequired:- id- product_iddiff --git a/docs/developer/core-concepts/pricing.mdx b/docs/developer/core-concepts/pricing.mdxindex 0febdfd665..469990d6c2 100644--- a/docs/developer/core-concepts/pricing.mdx+++ b/docs/developer/core-concepts/pricing.mdx@@ -163,6 +163,83 @@ Price Lists are managed in the Admin Panel under **Products → Price Lists**, oEach Price List contains prices for specific variants and currencies. Products can be added to a Price List, and individual variant prices set within it.+## Price History (EU Omnibus Directive)++Spree automatically records price changes for EU Omnibus Directive compliance. When a product goes on sale, EU regulations require displaying the lowest price in the preceding 30 days alongside the discounted price.++### How It Works++Every time a base price amount changes, a `PriceHistory` record is created automatically. Price list prices are not tracked — only the base price visible to all customers.++### Fetching Prior Price via API++The prior price is available as an expandable field on product and variant endpoints:++<CodeGroup>++```typescript SDK+const product = await client.products.get('spree-tote', {+ expand: ['prior_price'],+})++if (product.prior_price) {+ console.log(product.prior_price.amount) // "9.99"+ console.log(product.prior_price.display_amount) // "$9.99"+ console.log(product.prior_price.currency) // "USD"+ console.log(product.prior_price.recorded_at) // "2026-03-10T..."+}+```++```bash cURL+curl 'https://api.mystore.com/api/v3/store/products/spree-tote?expand=prior_price' \+ -H 'X-Spree-API-Key: spree_pk_xxx'+```++</CodeGroup>++The response includes a `prior_price` object when expanded:++```json+{+ "id": "prod_xxx",+ "name": "Spree Tote",+ "price": { "amount": "15.99", "currency": "USD", "display_amount": "$15.99" },+ "prior_price": {+ "amount": "9.99",+ "amount_in_cents": 999,+ "currency": "USD",+ "display_amount": "$9.99",+ "recorded_at": "2026-03-10T14:30:00Z"+ }+}+```++### Configuration++Price history tracking is enabled by default. To disable it (e.g., for non-EU stores):++```ruby+# config/initializers/spree.rb+Spree.config do |config|+ config.track_price_history = false+ config.price_history_retention_days = 30 # default+end+```++Price history retention defaults to 30 days and can be configured globally. A Rake task is provided for cleanup:++```bash+bundle exec rake spree:price_history:prune+```++### Seeding Existing Prices++After enabling price history on an existing store, seed the current prices as a baseline:++```bash+bundle exec rake spree:price_history:seed+```+## Related Documentation- [Products](/developer/core-concepts/products) — Products, Variants, and base pricesdiff --git a/docs/developer/sdk/store/products.mdx b/docs/developer/sdk/store/products.mdxindex 303bd6ac4c..8c81b9aa7b 100644--- a/docs/developer/sdk/store/products.mdx+++ b/docs/developer/sdk/store/products.mdx@@ -84,6 +84,27 @@ const product = await client.products.get('spree-tote', {});```+### Prior Price (EU Omnibus Directive)++When a product is on sale, EU regulations require displaying the lowest price in the last 30 days. Use the `prior_price` expand to fetch this:++```typescript+const product = await client.products.get('spree-tote', {+ expand: ['prior_price'],+});++if (product.prior_price) {+ console.log(product.prior_price.amount); // "9.99"+ console.log(product.prior_price.display_amount); // "$9.99"+ console.log(product.prior_price.currency); // "USD"+ console.log(product.prior_price.recorded_at); // "2026-03-10T..."+}+```++<Info>+Prior price is only relevant on product detail pages (PDP), not on listings. It returns `null` if no price history exists within the 30-day window. Price history tracking can be disabled globally via `Spree::Config[:track_price_history] = false`.+</Info>+### Product FiltersGet available filters (price range, availability, options, categories) and sort options for building filter UIs:diff --git a/docs/plans/5.4-6.0-eu-legal-compliance.md b/docs/plans/5.4-6.0-eu-legal-compliance.mdnew file mode 100644index 0000000000..7d04352682--- /dev/null+++ b/docs/plans/5.4-6.0-eu-legal-compliance.md@@ -0,0 +1,690 @@+# EU Legal Compliance (GDPR, Omnibus, Consumer Rights)++**Status:** Draft+**Target:** Spree 5.4 (Phase 1), Spree 6.0 (Phase 2)+**Depends on:** 6.0-platform-auth.md (Customer/Staff rename), 6.0-channels-catalogs-b2b.md (Market-level config)+**Author:** Damian + Claude+**Last updated:** 2026-03-23++## Summary++Add core infrastructure for EU legal compliance across three regulations: **GDPR** (data portability, erasure, consent), **Omnibus Directive** (30-day price history, sale price transparency), and **Consumer Rights Directive** (withdrawal period tracking). The goal is to make Spree viable for any EU merchant out of the box, while providing hooks for `spree_enterprise` to layer on management dashboards, automation, and multi-jurisdiction workflows.++Design principle: **Core provides the data model, services, and API. Enterprise provides the management UI and automation.**++Cookie consent is left to storefront implementations (Next.js, etc.) — not part of this plan.++## Key Decisions (do not deviate without discussion)++1. **Price history is a first-class model in core, not a plugin.** Every EU merchant needs Omnibus compliance. A `Spree::PriceHistory` record is created via the `PriceHistorySubscriber` on every base price change. Enabled by default (`track_price_history` store preference). US/APAC merchants who don't need Omnibus can turn it off per store.++2. **Customer data export and anonymization are core services.** `Spree::Customers::DataExporter` and `Spree::Customers::DataAnonymizer` live in core with Store API endpoints. These are not enterprise-only — any merchant processing EU customer data needs them.++3. **Anonymization preserves business records.** Orders, tax records, and financial data are retained with PII scrubbed. The order itself is never deleted — only the identifying information is replaced. This satisfies both GDPR erasure and accounting/tax retention requirements.++4. **Marketing consent gets a timestamp.** The existing `accepts_email_marketing` boolean stays, but gains a companion `email_marketing_consent_updated_at` column. The timestamp is legally required to prove when consent was given or withdrawn.++5. **Price history retention is configurable but defaults to 30 days.** Matches the Omnibus Directive requirement. Merchants who need longer retention can increase via store preference. A Rake task prunes old records.++6. **`prior_price` is opt-in via `?expand=prior_price`.** Omnibus lowest price is a PDP detail — no one shows it on product listings. A single `MIN` query per price on show is fine. No preloading needed.++7. **Withdrawal period is tracked per-Market in 6.0.** In 5.4, it's a store-level preference. In 6.0, the Market model (from channels-catalogs-b2b plan) owns it, since different markets may have different legal requirements.++8. **No encryption of PII at rest in this plan.** Application-level PII encryption is a separate concern (and often handled at the infrastructure level with encrypted-at-rest databases). This plan focuses on data lifecycle management, not storage encryption.++## Design Details++### Phase 1: Spree 5.4 — Omnibus Price History + GDPR Foundations++#### 1.1 Spree::PriceHistory Model++```ruby+class Spree::PriceHistory < Spree.base_class+ belongs_to :price, class_name: 'Spree::Price'+ belongs_to :variant, class_name: 'Spree::Variant'++ validates :amount, presence: true+ validates :currency, presence: true+ validates :recorded_at, presence: true++ scope :for_variant, ->(variant_id) { where(variant_id: variant_id) }+ scope :for_currency, ->(currency) { where(currency: currency) }+ scope :in_period, ->(from, to = Time.current) { where(recorded_at: from..to) }+ scope :recent, ->(days = 30) { in_period(days.days.ago) }+end+```++**Columns:**++| Column | Type | Notes |+|---|---|---|+| `price_id` | bigint, NOT NULL | FK to spree_prices |+| `variant_id` | bigint, NOT NULL | Denormalized for fast queries without join |+| `amount` | decimal(10,2), NOT NULL | Price at this point in time |+| `compare_at_amount` | decimal(10,2) | Compare-at price at this point in time |+| `currency` | string, NOT NULL | ISO currency code |+| `recorded_at` | datetime, NOT NULL | When this price took effect |+| `created_at` | datetime | |++Only base prices (where `price_list_id IS NULL`) are tracked. Price list prices are internal segmentation — the Omnibus Directive applies to the price the customer sees, which is always the base price.++**Indexes:**+- `[variant_id, currency, recorded_at]` — primary query path (lowest price lookup)+- `[price_id, recorded_at]` — price-specific history+- `[recorded_at]` — for retention cleanup++#### 1.2 Price Callback — Automatic History Recording++Callback on `Spree::Price` with `saved_change_to_amount?` guard — only records history when the amount actually changed, avoiding duplicate records from unrelated attribute updates.++```ruby+# In Spree::Price+class Spree::Price < Spree.base_class+ after_save :record_price_history, if: :should_record_price_history?++ private++ def should_record_price_history?+ price_list_id.nil? &&+ amount.present? &&+ saved_change_to_amount? &&+ Spree::Config[:track_price_history]+ end++ def record_price_history+ Spree::PriceHistory.create!(+ price: self,+ variant_id: variant_id,+ amount: amount,+ compare_at_amount: compare_at_amount,+ currency: currency,+ recorded_at: Time.current+ )+ end+end+```++#### 1.3 Lowest Price Query++```ruby+# In Spree::Price+class Spree::Price < Spree.base_class+ has_many :price_histories, class_name: 'Spree::PriceHistory'++ def prior_price+ price_histories.where(recorded_at: 30.days.ago..).minimum(:amount)+ end+end+```++This is only used on PDP (single product show), not on PLP (product listings). Omnibus lowest price is a sale-price detail — nobody displays it on collection pages. A single `MIN` query per price on show is fine.++#### 1.4 Seed Existing Prices++On migration, a Rake task snapshots all current prices as baseline history:++```ruby+# lib/tasks/price_history.rake+namespace :spree do+ desc 'Seed price history from existing prices (run once after migration)'+ task seed_price_history: :environment do+ Spree::Price.where(deleted_at: nil, price_list_id: nil).find_each do |price|+ next if price.amount.nil?+ next if Spree::PriceHistory.exists?(price_id: price.id)++ Spree::PriceHistory.create!(+ price: price,+ variant_id: price.variant_id,+ amount: price.amount,+ compare_at_amount: price.compare_at_amount,+ currency: price.currency,+ recorded_at: price.updated_at || Time.current+ )+ end+ end+end+```++#### 1.5 Retention Cleanup++```ruby+# lib/tasks/price_history.rake+namespace :spree do+ desc 'Prune price history older than retention period (per-store)'+ task prune_price_history: :environment do+ Spree::Store.find_each do |store|+ retention_days = store.preferences[:price_history_retention_days] || 30+ variant_ids = Spree::Product.joins(:stores).where(spree_stores: { id: store.id }).+ joins(:variants).pluck('spree_variants.id')++ next if variant_ids.empty?++ deleted = Spree::PriceHistory+ .where(variant_id: variant_ids)+ .where('recorded_at < ?', retention_days.days.ago)+ .delete_all++ puts "Store #{store.name}: pruned #{deleted} price history records older than #{retention_days} days"+ end+ end+end+```++#### 1.6 Store API — Price History Exposure++Add `prior_price` to variant and product serializers:++Opt-in via `?expand=prior_price` — only on product/variant show, not on listings:++```ruby+# In Spree::Api::V3::ProductSerializer+typelize prior_price: 'number | null'++attribute :prior_price,+ if: proc { params[:expand]&.include?('prior_price') } do |product, params|+ currency = params[:currency] || Spree::Current.currency+ product.default_variant.price_in(currency)&.prior_price+end+```++```ruby+# In Spree::Api::V3::VariantSerializer+typelize prior_price: 'number | null'++attribute :prior_price,+ if: proc { params[:expand]&.include?('prior_price') } do |variant, params|+ currency = params[:currency] || Spree::Current.currency+ variant.price_in(currency)&.prior_price+end+```++Usage: `GET /api/v3/store/products/:id?expand=prior_price`++#### 1.7 Marketing Consent Timestamp++Migration adds `email_marketing_consent_updated_at`:++```ruby+add_column :spree_users, :email_marketing_consent_updated_at, :datetime+```++Callback on user:+```ruby+# In Spree::UserMethods+before_save :track_marketing_consent_change, if: -> { will_save_change_to_attribute?('accepts_email_marketing') }++private++def track_marketing_consent_change+ self.email_marketing_consent_updated_at = Time.current+end+```++Update Store API customer serializer:+```ruby+# In Spree::Api::V3::CustomerSerializer+attributes :accepts_email_marketing, :email_marketing_consent_updated_at+```++#### 1.8 Customer Data Export API Endpoint++New Store API endpoint that returns the customer's data as structured JSON:++```ruby+# GET /api/v3/store/customer/data_export+module Spree::Api::V3::Store+ class CustomerDataExportsController < BaseController+ before_action :require_authentication++ def show+ exporter = Spree::Customers::DataExporter.new(current_customer)+ render json: exporter.call+ end+ end+end+```++```ruby+# core/app/services/spree/customers/data_exporter.rb+module Spree+ module Customers+ class DataExporter+ attr_reader :customer++ def initialize(customer)+ @customer = customer+ end++ def call+ {+ account: account_data,+ addresses: addresses_data,+ orders: orders_data,+ payment_sources: payment_sources_data,+ wishlists: wishlists_data,+ store_credits: store_credits_data,+ metafields: metafields_data,+ marketing_consent: marketing_consent_data,+ exported_at: Time.current.iso8601+ }+ end++ private++ def account_data+ {+ email: customer.email,+ first_name: customer.first_name,+ last_name: customer.last_name,+ phone: customer.try(:phone),+ created_at: customer.created_at&.iso8601,+ selected_locale: customer.try(:selected_locale)+ }+ end++ def addresses_data+ customer.addresses.not_deleted.map do |addr|+ {+ label: addr.label,+ first_name: addr.firstname,+ last_name: addr.lastname,+ address1: addr.address1,+ address2: addr.address2,+ city: addr.city,+ state: addr.state_text,+ postal_code: addr.zipcode,+ country: addr.country&.name,+ phone: addr.phone,+ company: addr.company+ }+ end+ end++ def orders_data+ customer.orders.complete.map do |order|+ {+ number: order.number,+ email: order.email,+ total: order.total&.to_s,+ currency: order.currency,+ completed_at: order.completed_at&.iso8601,+ special_instructions: order.special_instructions,+ billing_address: address_hash(order.bill_address),+ shipping_address: address_hash(order.ship_address),+ line_items: order.line_items.map { |li|+ { name: li.name, quantity: li.quantity, price: li.price&.to_s, currency: li.currency }+ }+ }+ end+ end++ def payment_sources_data+ customer.credit_cards.not_removed.map do |card|+ {+ type: card.cc_type,+ last_digits: card.last_digits,+ name: card.name,+ expiry_month: card.month,+ expiry_year: card.year+ }+ end+ end++ def wishlists_data+ return [] unless customer.respond_to?(:wishlists)++ customer.wishlists.map do |wishlist|+ {+ name: wishlist.name,+ items: wishlist.wished_items.map { |wi| { variant_id: wi.variant&.prefixed_id } }+ }+ end+ end++ def store_credits_data+ return [] unless customer.respond_to?(:store_credits)++ customer.store_credits.map do |credit|+ {+ amount: credit.amount&.to_s,+ currency: credit.currency,+ created_at: credit.created_at&.iso8601+ }+ end+ end++ def metafields_data+ return [] unless customer.respond_to?(:metafields)++ customer.metafields.where(visibility: 'public').map do |mf|+ { key: mf.key, value: mf.value, kind: mf.kind }+ end+ end++ def marketing_consent_data+ {+ accepts_email_marketing: customer.accepts_email_marketing,+ consent_updated_at: customer.try(:email_marketing_consent_updated_at)&.iso8601+ }+ end++ def address_hash(addr)+ return nil unless addr++ {+ first_name: addr.firstname,+ last_name: addr.lastname,+ address1: addr.address1,+ address2: addr.address2,+ city: addr.city,+ state: addr.state_text,+ postal_code: addr.zipcode,+ country: addr.country&.name,+ phone: addr.phone+ }+ end+ end+ end+end+```++#### 1.9 Customer Data Anonymization Service++Extends the existing `scramble_email_and_names` into a comprehensive anonymizer:++```ruby+# core/app/services/spree/customers/data_anonymizer.rb+module Spree+ module Customers+ class DataAnonymizer+ attr_reader :customer++ def initialize(customer)+ @customer = customer+ end++ # Returns true if anonymization was performed, false if blocked+ def call+ ActiveRecord::Base.transaction do+ anonymize_account+ anonymize_addresses+ anonymize_order_addresses+ anonymize_payment_sources+ anonymize_identities+ clear_metadata+ record_anonymization++ customer.publish_event('customer.anonymized')+ end++ true+ end++ private++ def anonymize_account+ anonymous_email = "anonymized+#{SecureRandom.uuid}@removed.invalid"+ customer.update!(+ email: anonymous_email,+ first_name: 'Anonymized',+ last_name: 'Customer',+ phone: nil,+ login: anonymous_email,+ accepts_email_marketing: false,+ email_marketing_consent_updated_at: Time.current,+ public_metadata: {},+ private_metadata: {}+ )+ end++ def anonymize_addresses+ customer.addresses.find_each do |addr|+ addr.update_columns(+ firstname: 'Anonymized',+ lastname: 'Customer',+ address1: 'Removed',+ address2: nil,+ city: 'Removed',+ phone: nil,+ company: nil,+ alternative_phone: nil,+ zipcode: addr.zipcode&.first(2)&.ljust(5, '*'), # Keep partial for tax jurisdiction+ deleted_at: Time.current+ )+ end+ end++ def anonymize_order_addresses+ # Anonymize billing/shipping addresses on completed orders+ # Preserve: country, state (needed for tax records), partial zip+ order_address_ids = customer.orders+ .pluck(:bill_address_id, :ship_address_id)+ .flatten.compact.uniq++ Spree::Address.where(id: order_address_ids).find_each do |addr|+ addr.update_columns(+ firstname: 'Anonymized',+ lastname: 'Customer',+ address1: 'Removed',+ address2: nil,+ phone: nil,+ company: nil,+ alternative_phone: nil,+ zipcode: addr.zipcode&.first(2)&.ljust(5, '*'),+ # Keep: city, state, country — needed for tax records+ )+ end+ end++ def anonymize_payment_sources+ customer.credit_cards.find_each do |card|+ card.update_columns(+ name: 'Anonymized',+ deleted_at: Time.current+ )+ end++ if customer.respond_to?(:gateway_customers)+ customer.gateway_customers.delete_all+ end+ end++ def anonymize_identities+ if customer.respond_to?(:user_identities)+ customer.user_identities.delete_all+ end+ end++ def clear_metadata+ # Clear order-level PII that isn't financial+ customer.orders.find_each do |order|+ order.update_columns(+ email: customer.email, # Already anonymized+ special_instructions: nil,+ last_ip_address: nil+ )+ end+ end++ def record_anonymization+ # Store anonymization record for compliance audit+ # Uses private_metadata on the user since they're already anonymized+ metadata = (customer.private_metadata || {}).merge(+ anonymized_at: Time.current.iso8601,+ anonymization_version: '1.0'+ )+ customer.update_column(:private_metadata, metadata)+ end+ end+ end+end+```++#### 1.10 Customer Data Erasure API Endpoint++```ruby+# DELETE /api/v3/store/customer+# Requires authentication + password confirmation+module Spree::Api::V3::Store+ class CustomersController < ResourceController+ # ... existing actions ...++ def destroy+ unless current_customer.valid_password?(params[:current_password])+ render json: { error: 'Invalid password' }, status: :unauthorized+ return+ end++ anonymizer = Spree::Customers::DataAnonymizer.new(current_customer)+ anonymizer.call++ head :no_content+ end+ end+end+```++After anonymization, the customer's JWT is invalidated (tokens reference an email that no longer matches).++### Phase 2: Spree 6.0 — Market-Level Legal Config + Enhanced Compliance++#### 2.1 Market Legal Configuration++When the Market model lands (from channels-catalogs-b2b plan), legal settings move to per-market:++```ruby+class Spree::Market < Spree.base_class+ # Legal settings+ attribute :withdrawal_period_days, :integer, default: 14+ attribute :price_history_display_days, :integer, default: 30+ attribute :data_retention_days, :integer # nil = indefinite+ attribute :legal_entity_name, :string+ attribute :legal_entity_address, :text+end+```++Until Markets land in 6.0, these are store-level preferences in 5.4:+```ruby+# In Spree::Store preferences+preference :withdrawal_period_days, :integer, default: 14+```++#### 2.2 Withdrawal Period on Orders++```ruby+class Spree::Order < Spree.base_class+ # Set on completion based on market/store config+ attribute :withdrawal_eligible_until, :datetime++ after_transition to: :complete, do: :set_withdrawal_deadline++ private++ def set_withdrawal_deadline+ days = store.preferred_withdrawal_period_days || 14+ update_column(:withdrawal_eligible_until, completed_at + days.days)+ end+end+```++Store API exposes this on completed orders:+```ruby+# In Spree::Api::V3::OrderSerializer+typelize withdrawal_eligible_until: 'string | null'+attribute :withdrawal_eligible_until do |order|+ order.withdrawal_eligible_until&.iso8601+end+```++#### 2.3 Enhanced Data Anonymization (6.0)++With the Customer/Staff rename (from platform-auth plan), the anonymizer gains:+- Automatic anonymization after configurable retention period (via `data_retention_days` on Market)+- Batch anonymization Rake task for inactive customers+- Admin API endpoint to trigger anonymization of specific customers++### Enterprise Hooks++The core services publish events that `spree_enterprise` can subscribe to:++| Core Event | Enterprise Feature |+|---|---|+| `price.updated` + PriceHistory record | Omnibus compliance dashboard, price change audit log |+| `customer.anonymized` | GDPR compliance log, DPO notification |+| `customer.data_exported` | Data access audit trail (Art. 30) |+| Marketing consent change | Consent management timeline |++Enterprise features built on core primitives:++| Feature | Core Primitive | Enterprise Layer |+|---|---|---|+| **GDPR dashboard** | DataExporter, DataAnonymizer | Admin UI: search customers, trigger export/anonymization, view audit log |+| **Automated data retention** | DataAnonymizer service | Scheduled job: anonymize customers inactive for N days |+| **Omnibus price dashboard** | PriceHistory model | Admin UI: price change timeline, Omnibus compliance status per product |+| **Multi-jurisdiction legal text** | Store/Market preferences | Admin UI: per-market legal text editor, withdrawal policy templates |+| **Breach notification workflow** | Events system | Incident tracker, 72-hour notification templates, DPA contact management |+| **Data processing register (Art. 30)** | Events system | Audit log of all PII access, processing purpose documentation |+| **Automated withdrawal handling** | `withdrawal_eligible_until` on Order | Return workflow auto-approval within withdrawal period |++## Migration++### 5.4 Migration++```ruby+class AddEuLegalComplianceFields < ActiveRecord::Migration[7.2]+ def change+ # Price history+ create_table :spree_price_histories do |t|+ t.references :price, null: false+ t.references :variant, null: false+ t.decimal :amount, precision: 10, scale: 2, null: false+ t.decimal :compare_at_amount, precision: 10, scale: 2+ t.string :currency, null: false+ t.datetime :recorded_at, null: false+ t.datetime :created_at, null: false+ end++ add_index :spree_price_histories, [:variant_id, :currency, :recorded_at],+ name: 'idx_price_histories_variant_currency_recorded'+ add_index :spree_price_histories, [:price_id, :recorded_at],+ name: 'idx_price_histories_price_recorded'+ add_index :spree_price_histories, :recorded_at,+ name: 'idx_price_histories_recorded_at'++ # Marketing consent timestamp+ add_column :spree_users, :email_marketing_consent_updated_at, :datetime++ # Withdrawal period+ add_column :spree_orders, :withdrawal_eligible_until, :datetime+ end+end+```++### Post-migration Rake task++```bash+bundle exec rake spree:price_history:seed # Snapshot existing prices+```++## Constraints on Current Work++- **Always record price changes.** Any code that modifies `Spree::Price#amount` must go through the model (not raw SQL `update_columns`), so the `after_save` callback fires and history is recorded.+- **Don't bypass DataAnonymizer.** Any customer deletion or data cleanup must use the anonymizer service, not direct record deletion or `scramble_email_and_names`.+- **Preserve order financial data on anonymization.** Never delete or modify: order totals, tax amounts, line item prices, payment amounts. Only PII fields (names, addresses, emails, IPs).+- **Don't add PII to order metadata without considering anonymization.** If storing customer-identifiable data in `public_metadata` or `private_metadata` on orders, ensure the anonymizer clears it.++## Open Questions++1. **Rate limiting on data export endpoint.** Should we enforce a cooldown (e.g., one export per 24 hours) to prevent abuse, or is standard API rate limiting sufficient?+2. **Admin-initiated anonymization in core vs enterprise.** The current plan puts admin-triggered anonymization in enterprise. Should core include an Admin API endpoint for it as well (with appropriate authorization)?++## References++- GDPR full text: Regulation (EU) 2016/679+- Omnibus Directive: Directive (EU) 2019/2161+- Consumer Rights Directive: 2011/83/EU+- Related plan: `6.0-platform-auth.md` — Customer/Staff model rename+- Related plan: `6.0-channels-catalogs-b2b.md` — Market model for per-market legal config+- Existing code: `Spree::UserMethods#scramble_email_and_names` (to be superseded by DataAnonymizer)+- Existing code: `Spree::Exports::Customers` + `Spree::CSV::CustomerPresenter` (CSV export — DataExporter builds on same data)+- Existing code: `Spree::Price#compare_at_amount` (Omnibus "was" price — history complements this)diff --git a/packages/admin-sdk/src/types/generated/PriceHistory.ts b/packages/admin-sdk/src/types/generated/PriceHistory.tsnew file mode 100644index 0000000000..6c9958954a--- /dev/null+++ b/packages/admin-sdk/src/types/generated/PriceHistory.ts@@ -0,0 +1,18 @@+// Typelizer digest 3fbefc5e95ad6a0ae420cecc1dd410b4+//+// DO NOT MODIFY: This file was automatically generated by Typelizer.++interface PriceHistory {+ id: string;+ amount: string;+ amount_in_cents: number;+ currency: string;+ display_amount: string;+ recorded_at: string;+ variant_id: string;+ price_id: string;+ compare_at_amount: string | null;+ created_at: string;+}++export default PriceHistory;diff --git a/packages/admin-sdk/src/types/generated/Product.ts b/packages/admin-sdk/src/types/generated/Product.tsindex 8818d17e87..b1e91efc58 100644--- a/packages/admin-sdk/src/types/generated/Product.ts+++ b/packages/admin-sdk/src/types/generated/Product.ts@@ -1,7 +1,7 @@-// Typelizer digest 11074ddf346cabee3c78138be8bafd95+// Typelizer digest bd7832f9418886d0390619311f47d31e//// DO NOT MODIFY: This file was automatically generated by Typelizer.-import type {Price, Media, Variant, OptionType, Category, Metafield} from '@/types'+import type {Price, PriceHistory, Media, Variant, OptionType, Category, Metafield} from '@/types'interface Product {id: string;@@ -31,6 +31,7 @@ interface Product {option_types?: Array<OptionType>;categories?: Array<Category>;metafields?: Array<Metafield>;+ prior_price?: PriceHistory | null;status: string;make_active_at: string | null;discontinue_on: string | null;diff --git a/packages/admin-sdk/src/types/generated/Variant.ts b/packages/admin-sdk/src/types/generated/Variant.tsindex 641f3c651b..6c6db1b35b 100644--- a/packages/admin-sdk/src/types/generated/Variant.ts+++ b/packages/admin-sdk/src/types/generated/Variant.ts@@ -1,7 +1,7 @@-// Typelizer digest 11a16f2d29e991ade611099f457468c5+// Typelizer digest a27edb567399482cfff90ea1dbee2e80//// DO NOT MODIFY: This file was automatically generated by Typelizer.-import type {Price, Media, OptionValue, Metafield} from '@/types'+import type {Price, PriceHistory, Media, OptionValue, Metafield} from '@/types'interface Variant {id: string;@@ -26,6 +26,7 @@ interface Variant {media?: Array<Media>;option_values: Array<OptionValue>;metafields?: Array<Metafield>;+ prior_price?: PriceHistory | null;position: number;tax_category_id: string | null;cost_price: string | null;diff --git a/packages/admin-sdk/src/types/generated/index.ts b/packages/admin-sdk/src/types/generated/index.tsindex 10d55dce1c..bf90832c99 100644--- a/packages/admin-sdk/src/types/generated/index.ts+++ b/packages/admin-sdk/src/types/generated/index.ts@@ -1,4 +1,4 @@-// Typelizer digest 1eda61f4ba3c7a33117be3b111c2fc09+// Typelizer digest 2e66340d6d59ddbe3e2db0810cd8cea2//// DO NOT MODIFY: This file was automatically generated by Typelizer.export type { default as Address } from './Address'@@ -24,6 +24,7 @@ export type { default as Order } from './Order'export type { default as PaymentMethod } from './PaymentMethod'export type { default as Payment } from './Payment'export type { default as PaymentSource } from './PaymentSource'+export type { default as PriceHistory } from './PriceHistory'export type { default as Price } from './Price'export type { default as Product } from './Product'export type { default as Refund } from './Refund'diff --git a/packages/sdk/README.md b/packages/sdk/README.mdindex 394293b63c..fe9d3016ca 100644--- a/packages/sdk/README.md+++ b/packages/sdk/README.md@@ -164,6 +164,12 @@ const product = await client.products.get('spree-tote', {expand: ['variants', 'media'],});+// Get product with prior price (EU Omnibus Directive compliance)+const product = await client.products.get('spree-tote', {+ expand: ['prior_price'],+});+console.log(product.prior_price); // { amount: "9.99", currency: "USD", display_amount: "$9.99", ... }+// Get available filters (price range, availability, options, categories)const filters = await client.products.filters({category_id: 'ctg_abc123', // Optional: scope filters to a category@@ -691,6 +697,7 @@ All types are exported as unprefixed names (e.g., `Product`, `Order`). Legacy `S### Product Types- `Media` - Product media (images, videos)- `Price` - Price data+- `PriceHistory` - Prior price data (for EU Omnibus Directive compliance)- `OptionType` - Option type (e.g., Size, Color)- `OptionValue` - Option value (e.g., Small, Red)- `DigitalLink` - Digital download linkdiff --git a/packages/sdk/src/types/generated/PriceHistory.ts b/packages/sdk/src/types/generated/PriceHistory.tsnew file mode 100644index 0000000000..08a9bc551a--- /dev/null+++ b/packages/sdk/src/types/generated/PriceHistory.ts@@ -0,0 +1,14 @@+// Typelizer digest 82799fb1cdb9d1035174afc6b1613ca8+//+// DO NOT MODIFY: This file was automatically generated by Typelizer.++interface PriceHistory {+ id: string;+ amount: string;+ amount_in_cents: number;+ currency: string;+ display_amount: string;+ recorded_at: string;+}++export default PriceHistory;diff --git a/packages/sdk/src/types/generated/Product.ts b/packages/sdk/src/types/generated/Product.tsindex 2368844d62..42d959b897 100644--- a/packages/sdk/src/types/generated/Product.ts+++ b/packages/sdk/src/types/generated/Product.ts@@ -1,7 +1,7 @@-// Typelizer digest bf78127d38c9fed7ebc783a52c3322bf+// Typelizer digest 3563e4fe0a7588a9536848acd527ee84//// DO NOT MODIFY: This file was automatically generated by Typelizer.-import type {Price, Media, Variant, OptionType, Category, Metafield} from '@/types'+import type {Price, PriceHistory, Media, Variant, OptionType, Category, Metafield} from '@/types'interface Product {id: string;@@ -31,6 +31,7 @@ interface Product {option_types?: Array<OptionType>;categories?: Array<Category>;metafields?: Array<Metafield>;+ prior_price?: PriceHistory | null;}export default Product;diff --git a/packages/sdk/src/types/generated/Variant.ts b/packages/sdk/src/types/generated/Variant.tsindex 040ae6c9ef..87f4a1feaf 100644--- a/packages/sdk/src/types/generated/Variant.ts+++ b/packages/sdk/src/types/generated/Variant.ts@@ -1,7 +1,7 @@-// Typelizer digest 37c8a7e0fead658658f18bc804ecc746+// Typelizer digest 2dcf2a0dd46a6186815dcb98b0624012//// DO NOT MODIFY: This file was automatically generated by Typelizer.-import type {Price, Media, OptionValue, Metafield} from '@/types'+import type {Price, PriceHistory, Media, OptionValue, Metafield} from '@/types'interface Variant {id: string;@@ -26,6 +26,7 @@ interface Variant {media?: Array<Media>;option_values: Array<OptionValue>;metafields?: Array<Metafield>;+ prior_price?: PriceHistory | null;}export default Variant;diff --git a/packages/sdk/src/types/generated/index.ts b/packages/sdk/src/types/generated/index.tsindex 0e3bbf93b8..2f64d1924a 100644--- a/packages/sdk/src/types/generated/index.ts+++ b/packages/sdk/src/types/generated/index.ts@@ -1,4 +1,4 @@-// Typelizer digest 4eeaa53c3702be006b83c52a632fbcd3+// Typelizer digest e4e7878b329b50b1fd9918c5497f2781//// DO NOT MODIFY: This file was automatically generated by Typelizer.export type { default as Address } from './Address'@@ -32,6 +32,7 @@ export type { default as Payment } from './Payment'export type { default as PaymentSession } from './PaymentSession'export type { default as PaymentSetupSession } from './PaymentSetupSession'export type { default as PaymentSource } from './PaymentSource'+export type { default as PriceHistory } from './PriceHistory'export type { default as Price } from './Price'export type { default as Product } from './Product'export type { default as Promotion } from './Promotion'diff --git a/packages/sdk/src/zod/generated/PriceHistory.ts b/packages/sdk/src/zod/generated/PriceHistory.tsnew file mode 100644index 0000000000..91ce6f0d19--- /dev/null+++ b/packages/sdk/src/zod/generated/PriceHistory.ts@@ -0,0 +1,13 @@+// This file is auto-generated. Do not edit directly.+import { z } from 'zod';++export const PriceHistorySchema = z.object({+ id: z.string(),+ amount: z.string(),+ amount_in_cents: z.number(),+ currency: z.string(),+ display_amount: z.string(),+ recorded_at: z.string(),+});++export type PriceHistory = z.infer<typeof PriceHistorySchema>;diff --git a/packages/sdk/src/zod/generated/Product.ts b/packages/sdk/src/zod/generated/Product.tsindex bdb3154525..112c64801b 100644--- a/packages/sdk/src/zod/generated/Product.ts+++ b/packages/sdk/src/zod/generated/Product.ts@@ -5,6 +5,7 @@ import { MediaSchema } from './Media';import { MetafieldSchema } from './Metafield';import { OptionTypeSchema } from './OptionType';import { PriceSchema } from './Price';+import { PriceHistorySchema } from './PriceHistory';import { VariantSchema } from './Variant';export const ProductSchema = z.object({@@ -35,6 +36,7 @@ export const ProductSchema = z.object({option_types: z.array(OptionTypeSchema).optional(),categories: z.array(z.lazy(() => CategorySchema)).optional(),metafields: z.array(MetafieldSchema).optional(),+ prior_price: PriceHistorySchema.nullable().optional(),});export type Product = z.infer<typeof ProductSchema>;diff --git a/packages/sdk/src/zod/generated/Variant.ts b/packages/sdk/src/zod/generated/Variant.tsindex ec17cb482a..9e00c44a75 100644--- a/packages/sdk/src/zod/generated/Variant.ts+++ b/packages/sdk/src/zod/generated/Variant.ts@@ -4,6 +4,7 @@ import { MediaSchema } from './Media';import { MetafieldSchema } from './Metafield';import { OptionValueSchema } from './OptionValue';import { PriceSchema } from './Price';+import { PriceHistorySchema } from './PriceHistory';export const VariantSchema = z.object({id: z.string(),@@ -28,6 +29,7 @@ export const VariantSchema = z.object({media: z.array(MediaSchema).optional(),option_values: z.array(OptionValueSchema),metafields: z.array(MetafieldSchema).optional(),+ prior_price: PriceHistorySchema.nullable().optional(),});export type Variant = z.infer<typeof VariantSchema>;diff --git a/packages/sdk/src/zod/generated/index.ts b/packages/sdk/src/zod/generated/index.tsindex 0978e0103f..7496c26419 100644--- a/packages/sdk/src/zod/generated/index.ts+++ b/packages/sdk/src/zod/generated/index.ts@@ -31,6 +31,7 @@ export { PaymentSessionSchema, type PaymentSession } from './PaymentSession';export { PaymentSetupSessionSchema, type PaymentSetupSession } from './PaymentSetupSession';export { PaymentSourceSchema, type PaymentSource } from './PaymentSource';export { PriceSchema, type Price } from './Price';+export { PriceHistorySchema, type PriceHistory } from './PriceHistory';export { ProductSchema, type Product } from './Product';export { PromotionSchema, type Promotion } from './Promotion';export { RefundSchema, type Refund } from './Refund';diff --git a/spree/api/app/serializers/spree/api/v3/admin/price_history_serializer.rb b/spree/api/app/serializers/spree/api/v3/admin/price_history_serializer.rbnew file mode 100644index 0000000000..87efd6f63a--- /dev/null+++ b/spree/api/app/serializers/spree/api/v3/admin/price_history_serializer.rb@@ -0,0 +1,26 @@+# frozen_string_literal: true++module Spree+ module Api+ module V3+ module Admin+ class PriceHistorySerializer < V3::PriceHistorySerializer+ typelize variant_id: :string,+ price_id: :string,+ compare_at_amount: [:string, nullable: true],+ created_at: :string++ attribute :variant_id do |price_history|+ price_history.variant.prefixed_id+ end++ attribute :price_id do |price_history|+ price_history.price.prefixed_id+ end++ attributes :compare_at_amount, created_at: :iso8601+ end+ end+ end+ end+enddiff --git a/spree/api/app/serializers/spree/api/v3/price_history_serializer.rb b/spree/api/app/serializers/spree/api/v3/price_history_serializer.rbnew file mode 100644index 0000000000..2d566e2b17--- /dev/null+++ b/spree/api/app/serializers/spree/api/v3/price_history_serializer.rb@@ -0,0 +1,25 @@+# frozen_string_literal: true++module Spree+ module Api+ module V3+ class PriceHistorySerializer < BaseSerializer+ typelize amount: :string,+ amount_in_cents: :number,+ display_amount: :string,+ currency: :string,+ recorded_at: :string++ attributes :amount, :amount_in_cents, :currency++ attribute :display_amount do |price_history|+ price_history.display_amount+ end++ attribute :recorded_at do |price_history|+ price_history.recorded_at&.iso8601+ end+ end+ end+ end+enddiff --git a/spree/api/app/serializers/spree/api/v3/product_serializer.rb b/spree/api/app/serializers/spree/api/v3/product_serializer.rbindex 89071d2b8b..a3d8a9c69d 100644--- a/spree/api/app/serializers/spree/api/v3/product_serializer.rb+++ b/spree/api/app/serializers/spree/api/v3/product_serializer.rb@@ -111,6 +111,14 @@ module Spreekey: :metafields,resource: Spree.api.metafield_serializer,if: proc { expand?('metafields') }++ typelize prior_price: ['PriceHistory', nullable: true]++ attribute :prior_price,+ if: proc { expand?('prior_price') } do |product|+ record = price_in(product.default_variant)&.prior_price+ Spree.api.price_history_serializer.new(record, params: params).to_h if record+ endendendenddiff --git a/spree/api/app/serializers/spree/api/v3/variant_serializer.rb b/spree/api/app/serializers/spree/api/v3/variant_serializer.rbindex 7399b60a27..071f43596c 100644--- a/spree/api/app/serializers/spree/api/v3/variant_serializer.rb+++ b/spree/api/app/serializers/spree/api/v3/variant_serializer.rb@@ -85,6 +85,14 @@ module Spreekey: :metafields,resource: Spree.api.metafield_serializer,if: proc { expand?('metafields') }++ typelize prior_price: ['PriceHistory', nullable: true]++ attribute :prior_price,+ if: proc { expand?('prior_price') } do |variant|+ record = price_in(variant)&.prior_price+ Spree.api.price_history_serializer.new(record, params: params).to_h if record+ endendendenddiff --git a/spree/api/lib/spree/api/dependencies.rb b/spree/api/lib/spree/api/dependencies.rbindex 3d51cb314e..5ced9e8015 100644--- a/spree/api/lib/spree/api/dependencies.rb+++ b/spree/api/lib/spree/api/dependencies.rb@@ -94,6 +94,7 @@ module Spree# v3 serializers (API v3)credit_card_serializer: 'Spree::Api::V3::CreditCardSerializer',price_serializer: 'Spree::Api::V3::PriceSerializer',+ price_history_serializer: 'Spree::Api::V3::PriceHistorySerializer',product_serializer: 'Spree::Api::V3::ProductSerializer',variant_serializer: 'Spree::Api::V3::VariantSerializer',media_serializer: 'Spree::Api::V3::MediaSerializer',@@ -160,6 +161,7 @@ module Spreeadmin_product_serializer: 'Spree::Api::V3::Admin::ProductSerializer',admin_variant_serializer: 'Spree::Api::V3::Admin::VariantSerializer',admin_price_serializer: 'Spree::Api::V3::Admin::PriceSerializer',+ admin_price_history_serializer: 'Spree::Api::V3::Admin::PriceHistorySerializer',admin_metafield_serializer: 'Spree::Api::V3::Admin::MetafieldSerializer',admin_category_serializer: 'Spree::Api::V3::Admin::CategorySerializer',admin_line_item_serializer: 'Spree::Api::V3::Admin::LineItemSerializer',diff --git a/spree/api/spec/integration/spree/api/v3/store/products_spec.rb b/spree/api/spec/integration/spree/api/v3/store/products_spec.rbindex e4581936cb..9ede774e89 100644--- a/spree/api/spec/integration/spree/api/v3/store/products_spec.rb+++ b/spree/api/spec/integration/spree/api/v3/store/products_spec.rb@@ -170,6 +170,45 @@ RSpec.describe 'Products API', type: :request, swagger_doc: 'api-reference/storerun_test!end+ response '200', 'product with prior_price expanded' do+ let(:'x-spree-api-key') { api_key.token }+ let(:id) { product.slug }+ let(:expand) { 'prior_price' }++ before do+ # Set up price history on all variant prices to ensure the+ # default_variant's price has history regardless of which variant is selected+ product.variants_including_master.each do |v|+ v.prices.base_prices.each do |price|+ price.price_histories.delete_all+ create(:price_history, price: price, variant: v, amount: 25.0, currency: price.currency, recorded_at: 1.day.ago)+ create(:price_history, price: price, variant: v, amount: 9.99, currency: price.currency, recorded_at: 15.days.ago)+ end+ end+ end++ run_test! do |response|+ data = JSON.parse(response.body)+ lowest = data['prior_price']+ expect(lowest).to be_present+ expect(lowest['amount']).to eq('9.99')+ expect(lowest['currency']).to eq('USD')+ expect(lowest['display_amount']).to be_present+ expect(lowest['amount_in_cents']).to eq(999)+ expect(lowest['recorded_at']).to be_present+ end+ end++ response '200', 'product without prior_price expanded does not include field' do+ let(:'x-spree-api-key') { api_key.token }+ let(:id) { product.slug }++ run_test! do |response|+ data = JSON.parse(response.body)+ expect(data).not_to have_key('prior_price')+ end+ end+response '404', 'draft product not visible' dolet(:'x-spree-api-key') { api_key.token }let(:id) { draft_product.slug }diff --git a/spree/api/spec/serializers/spree/api/v3/price_history_serializer_spec.rb b/spree/api/spec/serializers/spree/api/v3/price_history_serializer_spec.rbnew file mode 100644index 0000000000..9c8df59fbb--- /dev/null+++ b/spree/api/spec/serializers/spree/api/v3/price_history_serializer_spec.rb@@ -0,0 +1,70 @@+require 'spec_helper'++RSpec.describe Spree::Api::V3::PriceHistorySerializer do+ let(:store) { @default_store }+ let(:variant) { create(:variant) }+ let(:price) { variant.default_price }+ let(:base_params) { { store: store, currency: 'USD' } }++ let(:price_history) do+ create(:price_history, price: price, variant: variant, amount: 9.99, currency: 'USD', recorded_at: 10.days.ago)+ end++ subject { described_class.new(price_history, params: base_params).to_h }++ it 'includes amount fields' do+ expect(subject).to include(+ 'amount' => '9.99'.to_d,+ 'amount_in_cents' => 999,+ 'currency' => 'USD'+ )+ end++ it 'includes display_amount' do+ expect(subject['display_amount']).to eq('$9.99')+ end++ it 'includes recorded_at as ISO8601' do+ expect(subject['recorded_at']).to eq(price_history.recorded_at.iso8601)+ end++ context 'with a different currency' do+ let(:price_history) do+ create(:price_history, price: price, variant: variant, amount: 19.99, currency: 'EUR', recorded_at: 5.days.ago)+ end++ it 'uses the correct currency for display' do+ expect(subject['currency']).to eq('EUR')+ expect(subject['amount']).to eq('19.99'.to_d)+ end+ end+end++RSpec.describe Spree::Api::V3::Admin::PriceHistorySerializer do+ let(:store) { @default_store }+ let(:variant) { create(:variant) }+ let(:price) { variant.default_price }+ let(:base_params) { { store: store, currency: 'USD' } }++ let(:price_history) do+ create(:price_history, price: price, variant: variant, amount: 9.99, compare_at_amount: 14.99, currency: 'USD', recorded_at: 10.days.ago)+ end++ subject { described_class.new(price_history, params: base_params).to_h }++ it 'includes store serializer fields' do+ expect(subject).to include(+ 'amount' => '9.99'.to_d,+ 'amount_in_cents' => 999,+ 'currency' => 'USD',+ 'display_amount' => '$9.99'+ )+ end++ it 'includes admin-only fields' do+ expect(subject['variant_id']).to eq(variant.prefixed_id)+ expect(subject['price_id']).to eq(price.prefixed_id)+ expect(subject['compare_at_amount']).to eq('14.99'.to_d)+ expect(subject['created_at']).to be_present+ end+enddiff --git a/spree/core/app/models/spree/price.rb b/spree/core/app/models/spree/price.rbindex c066e0aa7b..fdfdb479d9 100644--- a/spree/core/app/models/spree/price.rb+++ b/spree/core/app/models/spree/price.rb@@ -13,8 +13,11 @@ module Spreebelongs_to :variant, -> { with_deleted }, class_name: 'Spree::Variant', inverse_of: :prices, touch: truebelongs_to :price_list, class_name: 'Spree::PriceList', optional: true+ has_many :price_histories, class_name: 'Spree::PriceHistory', dependent: :delete_all+before_validation :ensure_currencybefore_save :remove_compare_at_amount_if_equals_amount+ after_save :record_price_history, if: :should_record_price_history?# legacy behaviorvalidates :amount, allow_nil: true, numericality: {@@ -156,8 +159,34 @@ module Spree!zero?end+ # Returns the price history record with the lowest amount in the last 30 days+ # Used for EU Omnibus Directive compliance+ #+ # @return [Spree::PriceHistory, nil]+ def prior_price+ price_histories.where(recorded_at: 30.days.ago..).order(:amount).first+ end+private+ def should_record_price_history?+ price_list_id.nil? &&+ amount.present? &&+ saved_change_to_amount? &&+ Spree::Config[:track_price_history]+ end++ def record_price_history+ Spree::PriceHistory.create!(+ price: self,+ variant_id: variant_id,+ amount: amount,+ compare_at_amount: compare_at_amount,+ currency: currency,+ recorded_at: Time.current+ )+ end+def ensure_currencyself.currency ||= Spree::Store.default.default_currencyenddiff --git a/spree/core/app/models/spree/price_history.rb b/spree/core/app/models/spree/price_history.rbnew file mode 100644index 0000000000..1c5f05705c--- /dev/null+++ b/spree/core/app/models/spree/price_history.rb@@ -0,0 +1,29 @@+# frozen_string_literal: true++module Spree+ class PriceHistory < Spree.base_class+ belongs_to :price, class_name: 'Spree::Price'+ belongs_to :variant, class_name: 'Spree::Variant'++ validates :amount, presence: true, numericality: { greater_than_or_equal_to: 0 }+ validates :currency, presence: true+ validates :recorded_at, presence: true++ scope :for_variant, ->(variant_id) { where(variant_id: variant_id) }+ scope :for_currency, ->(currency) { where(currency: currency) }+ scope :in_period, ->(from, to = Time.current) { where(recorded_at: from..to) }+ scope :recent, ->(days = 30) { in_period(days.days.ago) }++ def money+ Spree::Money.new(amount || 0, currency: currency)+ end++ def display_amount+ money.to_s+ end++ def amount_in_cents+ money.amount_in_cents+ end+ end+enddiff --git a/spree/core/db/migrate/20260323000000_create_spree_price_histories.rb b/spree/core/db/migrate/20260323000000_create_spree_price_histories.rbnew file mode 100644index 0000000000..acb63d443e--- /dev/null+++ b/spree/core/db/migrate/20260323000000_create_spree_price_histories.rb@@ -0,0 +1,20 @@+class CreateSpreePriceHistories < ActiveRecord::Migration[7.2]+ def change+ create_table :spree_price_histories do |t|+ t.references :price, null: false, index: false+ t.references :variant, null: false, index: false+ t.decimal :amount, precision: 10, scale: 2, null: false+ t.decimal :compare_at_amount, precision: 10, scale: 2+ t.string :currency, null: false+ t.datetime :recorded_at, null: false+ t.datetime :created_at, null: false+ end++ add_index :spree_price_histories, [:variant_id, :currency, :recorded_at],+ name: 'idx_price_histories_variant_currency_recorded'+ add_index :spree_price_histories, [:price_id, :recorded_at],+ name: 'idx_price_histories_price_recorded'+ add_index :spree_price_histories, :recorded_at,+ name: 'idx_price_histories_recorded_at'+ end+enddiff --git a/spree/core/lib/spree/core/configuration.rb b/spree/core/lib/spree/core/configuration.rbindex 7784304091..61fbe776c7 100644--- a/spree/core/lib/spree/core/configuration.rb+++ b/spree/core/lib/spree/core/configuration.rb@@ -96,6 +96,8 @@ module Spreepreference :tax_using_ship_address, :boolean, default: truepreference :title_site_name_separator, :string, deprecated: truepreference :track_inventory_levels, :boolean, default: true # Determines whether to track on_hand values for variants / products.+ preference :track_price_history, :boolean, default: true # Records price changes for Omnibus Directive compliance. Disable for non-EU stores.+ preference :price_history_retention_days, :integer, default: 30 # Days to retain price history records. Used by spree:price_history:prune rake task.preference :use_user_locale, :boolean, default: true# Sets the path used for products, taxons and pages.diff --git a/spree/core/lib/spree/testing_support/factories/price_history_factory.rb b/spree/core/lib/spree/testing_support/factories/price_history_factory.rbnew file mode 100644index 0000000000..378bf9c6b7--- /dev/null+++ b/spree/core/lib/spree/testing_support/factories/price_history_factory.rb@@ -0,0 +1,9 @@+FactoryBot.define do+ factory :price_history, class: Spree::PriceHistory do+ price+ variant { price.variant }+ amount { price.amount }+ currency { price.currency }+ recorded_at { Time.current }+ end+enddiff --git a/spree/core/lib/tasks/price_history.rake b/spree/core/lib/tasks/price_history.rakenew file mode 100644index 0000000000..c9e2aec448--- /dev/null+++ b/spree/core/lib/tasks/price_history.rake@@ -0,0 +1,36 @@+# frozen_string_literal: true++namespace :spree do+ namespace :price_history do+ desc 'Seed price history from existing base prices (run once after migration)'+ task seed: :environment do+ count = 0+ Spree::Price.where(deleted_at: nil, price_list_id: nil).find_each do |price|+ next if price.amount.nil?+ next if Spree::PriceHistory.exists?(price_id: price.id)++ Spree::PriceHistory.create!(+ price: price,+ variant_id: price.variant_id,+ amount: price.amount,+ compare_at_amount: price.compare_at_amount,+ currency: price.currency,+ recorded_at: price.updated_at || Time.current+ )+ count += 1+ end++ puts "Seeded #{count} price history records"+ end++ desc 'Prune price history older than retention period'+ task prune: :environment do+ retention_days = Spree::Config[:price_history_retention_days] || 30+ deleted = Spree::PriceHistory+ .where('recorded_at < ?', retention_days.days.ago)+ .delete_all++ puts "Pruned #{deleted} price history records older than #{retention_days} days"+ end+ end+enddiff --git a/spree/core/spec/models/spree/price_history_spec.rb b/spree/core/spec/models/spree/price_history_spec.rbnew file mode 100644index 0000000000..0c0aef1405--- /dev/null+++ b/spree/core/spec/models/spree/price_history_spec.rb@@ -0,0 +1,37 @@+require 'spec_helper'++describe Spree::PriceHistory, type: :model do+ describe 'scopes' do+ let(:variant) { create(:variant) }+ let(:price) { variant.default_price }++ before do+ # Materialize lets, then clear history created by variant/price setup+ price+ Spree::PriceHistory.delete_all++ create(:price_history, price: price, variant: variant, amount: 10.0, currency: 'USD', recorded_at: 5.days.ago)+ create(:price_history, price: price, variant: variant, amount: 15.0, currency: 'USD', recorded_at: 20.days.ago)+ create(:price_history, price: price, variant: variant, amount: 25.0, currency: 'USD', recorded_at: 45.days.ago)+ end++ describe '.recent' do+ it 'returns records within the default 30-day window' do+ expect(described_class.recent.count).to eq(2)+ end++ it 'respects custom day count' do+ expect(described_class.recent(10).count).to eq(1)+ end+ end++ describe '.for_currency' do+ it 'filters by currency' do+ create(:price_history, price: price, variant: variant, amount: 5.0, currency: 'EUR', recorded_at: 1.day.ago)++ expect(described_class.for_currency('USD').count).to eq(3)+ expect(described_class.for_currency('EUR').count).to eq(1)+ end+ end+ end+enddiff --git a/spree/core/spec/models/spree/price_spec.rb b/spree/core/spec/models/spree/price_spec.rbindex e9bdea7351..3309964b57 100644--- a/spree/core/spec/models/spree/price_spec.rb+++ b/spree/core/spec/models/spree/price_spec.rb@@ -385,4 +385,106 @@ describe Spree::Price, type: :model doit { is_expected.to be(false) }endend++ describe '#record_price_history' do+ let(:store) { create(:store) }+ let(:variant) { create(:variant) }+ let(:price) { variant.default_price }++ before do+ # Materialize lets and clear history from setup+ price+ Spree::PriceHistory.delete_all+ end++ context 'when amount changes on a base price' do+ it 'creates a price history record' do+ expect {+ price.update!(amount: 29.99)+ }.to change { price.price_histories.count }.by(1)++ history = price.price_histories.last+ expect(history.variant).to eq(variant)+ expect(history.amount).to eq(29.99)+ expect(history.currency).to eq(price.currency)+ expect(history.recorded_at).to be_present+ end+ end++ context 'when only compare_at_amount changes' do+ it 'does not create a price history record' do+ expect {+ price.update!(compare_at_amount: 39.99)+ }.not_to change { price.price_histories.count }+ end+ end++ context 'when price belongs to a price list' do+ let(:price_list) { create(:price_list, store: store) }++ it 'does not create a price history record' do+ list_price = create(:price, variant: variant, price_list: price_list, amount: 10.0, currency: 'USD')++ expect {+ list_price.update!(amount: 15.0)+ }.not_to change { list_price.price_histories.count }+ end+ end++ context 'when track_price_history is disabled' do+ before do+ Spree::Config[:track_price_history] = false+ end++ after do+ Spree::Config[:track_price_history] = true+ end++ it 'does not create a price history record' do+ expect {+ price.update!(amount: 29.99)+ }.not_to change { price.price_histories.count }+ end+ end++ context 'when creating a new base price' do+ it 'creates a price history record' do+ new_price = create(:price, variant: variant, amount: 25.0, currency: 'EUR')++ expect(new_price.price_histories.count).to eq(1)+ expect(new_price.price_histories.first.amount).to eq(25.0)+ end+ end+ end++ describe '#prior_price' do+ let(:variant) { create(:variant) }+ let(:price) { variant.default_price }++ before do+ price+ price.price_histories.delete_all+ end++ context 'with price history' do+ before do+ create(:price_history, price: price, variant: variant, amount: 15.0, currency: price.currency, recorded_at: 5.days.ago)+ create(:price_history, price: price, variant: variant, amount: 10.0, currency: price.currency, recorded_at: 20.days.ago)+ create(:price_history, price: price, variant: variant, amount: 5.0, currency: price.currency, recorded_at: 45.days.ago)+ end++ it 'returns the price history record with the lowest amount within 30 days' do+ result = price.prior_price+ expect(result).to be_a(Spree::PriceHistory)+ expect(result.amount).to eq(10.0)+ expect(result.currency).to eq(price.currency)+ end+ end++ context 'without price history' do+ it 'returns nil' do+ expect(price.prior_price).to be_nil+ end+ end+ endend