Skip to content

armgit / spree

Public Imported from GitHub
0

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

Added bulk operations for products in admin APi/SDK/SPA

Damian Legawiec21fad2eb19af
diff --git a/docs/api-reference/admin.yaml b/docs/api-reference/admin.yaml
index 38560a773d..7dc7eb88be 100644
--- a/docs/api-reference/admin.yaml
+++ b/docs/api-reference/admin.yaml
@@ -82,12 +82,12 @@ paths:
example:
data:
- id: admin_UkLWZg9DAJ
- first_name: Salome
- last_name: Mraz
- full_name: Salome Mraz
- created_at: '2026-05-23T20:22:47.334Z'
- updated_at: '2026-05-23T20:22:47.334Z'
+ first_name: Naomi
+ last_name: Hand
+ full_name: Naomi Hand
+ created_at: '2026-05-24T16:06:59.324Z'
+ updated_at: '2026-05-24T16:06:59.324Z'
roles:
- id: role_UkLWZg9DAJ
name: admin
@@ -145,12 +145,12 @@ paths:
application/json:
example:
id: admin_UkLWZg9DAJ
- first_name: Eunice
- last_name: Abbott
- full_name: Eunice Abbott
- created_at: '2026-05-23T20:22:47.685Z'
- updated_at: '2026-05-23T20:22:47.685Z'
+ first_name: Lizzie
+ last_name: Mraz
+ full_name: Lizzie Mraz
+ created_at: '2026-05-24T16:06:59.676Z'
+ updated_at: '2026-05-24T16:06:59.676Z'
roles:
- id: role_UkLWZg9DAJ
name: admin
@@ -203,12 +203,12 @@ paths:
application/json:
example:
id: admin_UkLWZg9DAJ
first_name: Renamed
- last_name: Kassulke
- full_name: Renamed Kassulke
- created_at: '2026-05-23T20:22:47.981Z'
- updated_at: '2026-05-23T20:22:48.019Z'
+ last_name: Jakubowski
+ full_name: Renamed Jakubowski
+ created_at: '2026-05-24T16:06:59.975Z'
+ updated_at: '2026-05-24T16:07:00.014Z'
roles:
- id: role_UkLWZg9DAJ
name: admin
@@ -317,32 +317,32 @@ paths:
key_type: publishable
token_prefix:
scopes: []
- created_at: '2026-05-23T20:22:48.317Z'
- updated_at: '2026-05-23T20:22:48.317Z'
+ created_at: '2026-05-24T16:07:00.307Z'
+ updated_at: '2026-05-24T16:07:00.307Z'
revoked_at:
last_used_at:
- plaintext_token: pk_2BD9tj8zXw868BG3vr6N2XcV
+ plaintext_token: pk_EGki2qBcCbDiLWqHc2ojJhQZ
created_by_email:
- id: key_gbHJdmfrXB
name: Backend integration
key_type: secret
- token_prefix: sk_wWjEcHHyC
+ token_prefix: sk_i9UP3kJVU
scopes:
- write_all
- created_at: '2026-05-23T20:22:48.317Z'
- updated_at: '2026-05-23T20:22:48.317Z'
+ created_at: '2026-05-24T16:07:00.308Z'
+ updated_at: '2026-05-24T16:07:00.308Z'
revoked_at:
last_used_at:
plaintext_token:
created_by_email:
- id: key_EfhxLZ9ck8
- name: doloremque
+ name: aspernatur
key_type: secret
- token_prefix: sk_rvJ3Acx96
+ token_prefix: sk_7WBMLjEz7
scopes:
- write_all
- created_at: '2026-05-23T20:22:48.318Z'
- updated_at: '2026-05-23T20:22:48.318Z'
+ created_at: '2026-05-24T16:07:00.308Z'
+ updated_at: '2026-05-24T16:07:00.308Z'
revoked_at:
last_used_at:
plaintext_token:
@@ -405,15 +405,15 @@ paths:
id: key_VqXmZF31wY
name: CI key
key_type: secret
- token_prefix: sk_KpLtEWXDW
+ token_prefix: sk_DCwDatNSU
scopes:
- read_orders
- created_at: '2026-05-23T20:22:48.870Z'
- updated_at: '2026-05-23T20:22:48.870Z'
+ created_at: '2026-05-24T16:07:00.888Z'
+ updated_at: '2026-05-24T16:07:00.888Z'
revoked_at:
last_used_at:
- plaintext_token: sk_KpLtEWXDWnEph4LBeFGFo6Qa
- created_by_email: [email protected]
+ plaintext_token: sk_DCwDatNSUhFo54twCeGTAViZ
+ created_by_email: [email protected]
'422':
description: validation error
content:
@@ -499,11 +499,11 @@ paths:
key_type: publishable
token_prefix:
scopes: []
- created_at: '2026-05-23T20:22:49.150Z'
- updated_at: '2026-05-23T20:22:49.150Z'
+ created_at: '2026-05-24T16:07:01.243Z'
+ updated_at: '2026-05-24T16:07:01.243Z'
revoked_at:
last_used_at:
- plaintext_token: pk_sACQ4j6WEAd9heGe1Vabm6tn
+ plaintext_token: pk_z37d3ct5uyUrpq3LiH2hS7Qv
created_by_email:
delete:
summary: Delete an API key
@@ -593,12 +593,12 @@ paths:
id: key_gbHJdmfrXB
name: Backend integration
key_type: secret
- token_prefix: sk_Ku896k9pF
+ token_prefix: sk_NAFkow191
scopes:
- write_all
- created_at: '2026-05-23T20:22:49.701Z'
- updated_at: '2026-05-23T20:22:49.974Z'
- revoked_at: '2026-05-23T20:22:49.973Z'
+ created_at: '2026-05-24T16:07:01.813Z'
+ updated_at: '2026-05-24T16:07:02.088Z'
+ revoked_at: '2026-05-24T16:07:02.087Z'
last_used_at:
plaintext_token:
created_by_email:
@@ -653,15 +653,15 @@ paths:
- id: coupon_UkLWZg9DAJ
code: AAA111
state: unused
- created_at: '2026-05-23T20:22:49.989Z'
- updated_at: '2026-05-23T20:22:49.989Z'
+ created_at: '2026-05-24T16:07:02.107Z'
+ updated_at: '2026-05-24T16:07:02.107Z'
promotion_id: promo_UkLWZg9DAJ
order_id:
- id: coupon_gbHJdmfrXB
code: BBB222
state: unused
- created_at: '2026-05-23T20:22:49.990Z'
- updated_at: '2026-05-23T20:22:49.990Z'
+ created_at: '2026-05-24T16:07:02.108Z'
+ updated_at: '2026-05-24T16:07:02.108Z'
promotion_id: promo_UkLWZg9DAJ
order_id:
meta:
@@ -739,8 +739,8 @@ paths:
field_type: short_text
resource_type: Spree::Product
storefront_visible: true
- created_at: '2026-05-23T20:22:50.286Z'
- updated_at: '2026-05-23T20:22:50.286Z'
+ created_at: '2026-05-24T16:07:02.420Z'
+ updated_at: '2026-05-24T16:07:02.420Z'
- id: cfdef_gbHJdmfrXB
namespace: custom
key: order_notes
@@ -748,8 +748,8 @@ paths:
field_type: short_text
resource_type: Spree::Order
storefront_visible: true
- created_at: '2026-05-23T20:22:50.287Z'
- updated_at: '2026-05-23T20:22:50.287Z'
+ created_at: '2026-05-24T16:07:02.421Z'
+ updated_at: '2026-05-24T16:07:02.421Z'
meta:
page: 1
limit: 25
@@ -812,8 +812,8 @@ paths:
field_type: short_text
resource_type: Spree::Product
storefront_visible: true
- created_at: '2026-05-23T20:22:50.839Z'
- updated_at: '2026-05-23T20:22:50.839Z'
+ created_at: '2026-05-24T16:07:03.030Z'
+ updated_at: '2026-05-24T16:07:03.030Z'
requestBody:
content:
application/json:
@@ -896,8 +896,8 @@ paths:
field_type: short_text
resource_type: Spree::Product
storefront_visible: true
- created_at: '2026-05-23T20:22:50.841Z'
- updated_at: '2026-05-23T20:22:50.841Z'
+ created_at: '2026-05-24T16:07:03.033Z'
+ updated_at: '2026-05-24T16:07:03.033Z'
patch:
summary: Update a custom field definition
tags:
@@ -936,8 +936,8 @@ paths:
field_type: short_text
resource_type: Spree::Product
storefront_visible: false
- created_at: '2026-05-23T20:22:51.118Z'
- updated_at: '2026-05-23T20:22:51.392Z'
+ created_at: '2026-05-24T16:07:03.315Z'
+ updated_at: '2026-05-24T16:07:03.597Z'
requestBody:
content:
application/json:
@@ -1061,14 +1061,14 @@ paths:
name: VIPs
description: Top spenders
customers_count: 0
- created_at: '2026-05-23T20:22:51.673Z'
- updated_at: '2026-05-23T20:22:51.673Z'
+ created_at: '2026-05-24T16:07:03.892Z'
+ updated_at: '2026-05-24T16:07:03.892Z'
- id: cg_gbHJdmfrXB
name: Wholesale
description:
customers_count: 0
- created_at: '2026-05-23T20:22:51.674Z'
- updated_at: '2026-05-23T20:22:51.674Z'
+ created_at: '2026-05-24T16:07:03.893Z'
+ updated_at: '2026-05-24T16:07:03.893Z'
meta:
page: 1
limit: 25
@@ -1153,8 +1153,8 @@ paths:
name: Wholesale 2
description: B2B accounts
customers_count: 1
- created_at: '2026-05-23T20:22:52.527Z'
- updated_at: '2026-05-23T20:22:52.527Z'
+ created_at: '2026-05-24T16:07:04.903Z'
+ updated_at: '2026-05-24T16:07:04.903Z'
schema:
"$ref": "#/components/schemas/CustomerGroup"
'422':
@@ -1260,24 +1260,24 @@ paths:
name: VIPs
description: Top spenders
customers_count: 1
- created_at: '2026-05-23T20:22:53.119Z'
- updated_at: '2026-05-23T20:22:53.119Z'
+ created_at: '2026-05-24T16:07:05.506Z'
+ updated_at: '2026-05-24T16:07:05.506Z'
customers:
- id: cus_UkLWZg9DAJ
- first_name: Tona
- last_name: Carter
+ first_name: Damien
+ last_name: Turcotte
phone:
accepts_email_marketing: false
- full_name: Tona Carter
+ full_name: Damien Turcotte
available_store_credit_total: '0'
display_available_store_credit_total: "$0.00"
metadata: {}
last_sign_in_at:
current_sign_in_at:
- created_at: '2026-05-23T20:22:53.380Z'
- updated_at: '2026-05-23T20:22:53.380Z'
+ created_at: '2026-05-24T16:07:05.771Z'
+ updated_at: '2026-05-24T16:07:05.771Z'
sign_in_count: 0
failed_attempts: 0
last_sign_in_ip:
@@ -1355,8 +1355,8 @@ paths:
name: VIP customers (Q1)
description: Top spenders
customers_count: 0
- created_at: '2026-05-23T20:22:53.960Z'
- updated_at: '2026-05-23T20:22:54.234Z'
+ created_at: '2026-05-24T16:07:06.350Z'
+ updated_at: '2026-05-24T16:07:06.632Z'
schema:
"$ref": "#/components/schemas/CustomerGroup"
'422':
@@ -1509,8 +1509,8 @@ paths:
state_name: New York
label:
metadata: {}
- created_at: '2026-05-23T20:22:55.061Z'
- updated_at: '2026-05-23T20:22:55.061Z'
+ created_at: '2026-05-24T16:07:07.463Z'
+ updated_at: '2026-05-24T16:07:07.463Z'
customer_id: cus_UkLWZg9DAJ
meta:
page: 1
@@ -1598,8 +1598,8 @@ paths:
state_name: New York
label: Office
metadata: {}
- created_at: '2026-05-23T20:22:56.396Z'
- updated_at: '2026-05-23T20:22:56.396Z'
+ created_at: '2026-05-24T16:07:08.935Z'
+ updated_at: '2026-05-24T16:07:08.935Z'
customer_id: cus_UkLWZg9DAJ
requestBody:
content:
@@ -1710,8 +1710,8 @@ paths:
state_name: New York
label:
metadata: {}
- created_at: '2026-05-23T20:22:56.661Z'
- updated_at: '2026-05-23T20:22:57.194Z'
+ created_at: '2026-05-24T16:07:09.213Z'
+ updated_at: '2026-05-24T16:07:09.773Z'
customer_id: cus_UkLWZg9DAJ
requestBody:
content:
@@ -1844,8 +1844,8 @@ paths:
customer_id: cus_UkLWZg9DAJ
payment_method_id: pm_UkLWZg9DAJ
metadata: {}
- created_at: '2026-05-23T20:22:58.272Z'
- updated_at: '2026-05-23T20:22:58.272Z'
+ created_at: '2026-05-24T16:07:11.148Z'
+ updated_at: '2026-05-24T16:07:11.148Z'
meta:
page: 1
limit: 25
@@ -1932,8 +1932,8 @@ paths:
customer_id: cus_UkLWZg9DAJ
payment_method_id: pm_UkLWZg9DAJ
metadata: {}
- created_at: '2026-05-23T20:22:58.817Z'
- updated_at: '2026-05-23T20:22:58.817Z'
+ created_at: '2026-05-24T16:07:11.700Z'
+ updated_at: '2026-05-24T16:07:11.700Z'
delete:
summary: Delete a customer credit card
tags:
@@ -2052,8 +2052,8 @@ paths:
currency: USD
memo:
metadata: {}
- created_at: '2026-05-23T20:23:00.165Z'
- updated_at: '2026-05-23T20:23:00.165Z'
+ created_at: '2026-05-24T16:07:13.070Z'
+ updated_at: '2026-05-24T16:07:13.070Z'
customer_id: cus_UkLWZg9DAJ
created_by_id: admin_UkLWZg9DAJ
category_id: sccat_UkLWZg9DAJ
@@ -2128,8 +2128,8 @@ paths:
currency: USD
memo: Goodwill
metadata: {}
- created_at: '2026-05-23T20:23:01.322Z'
- updated_at: '2026-05-23T20:23:01.322Z'
+ created_at: '2026-05-24T16:07:14.186Z'
+ updated_at: '2026-05-24T16:07:14.186Z'
customer_id: cus_UkLWZg9DAJ
created_by_id: admin_gbHJdmfrXB
category_id: sccat_UkLWZg9DAJ
@@ -2220,8 +2220,8 @@ paths:
currency: USD
memo: Updated
metadata: {}
- created_at: '2026-05-23T20:23:01.854Z'
- updated_at: '2026-05-23T20:23:02.131Z'
+ created_at: '2026-05-24T16:07:14.750Z'
+ updated_at: '2026-05-24T16:07:15.069Z'
customer_id: cus_UkLWZg9DAJ
created_by_id: admin_UkLWZg9DAJ
category_id: sccat_UkLWZg9DAJ
@@ -2375,8 +2375,8 @@ paths:
metadata: {}
last_sign_in_at:
current_sign_in_at:
- created_at: '2026-05-23T20:23:03.203Z'
- updated_at: '2026-05-23T20:23:03.203Z'
+ created_at: '2026-05-24T16:07:16.176Z'
+ updated_at: '2026-05-24T16:07:16.176Z'
sign_in_count: 0
failed_attempts: 0
last_sign_in_ip:
@@ -2459,8 +2459,8 @@ paths:
metadata: {}
last_sign_in_at:
current_sign_in_at:
- created_at: '2026-05-23T20:23:04.017Z'
- updated_at: '2026-05-23T20:23:04.017Z'
+ created_at: '2026-05-24T16:07:17.003Z'
+ updated_at: '2026-05-24T16:07:17.003Z'
sign_in_count: 0
failed_attempts: 0
last_sign_in_ip:
@@ -2576,8 +2576,8 @@ paths:
metadata: {}
last_sign_in_at:
current_sign_in_at:
- created_at: '2026-05-23T20:23:04.282Z'
- updated_at: '2026-05-23T20:23:04.282Z'
+ created_at: '2026-05-24T16:07:17.280Z'
+ updated_at: '2026-05-24T16:07:17.280Z'
sign_in_count: 0
failed_attempts: 0
last_sign_in_ip:
@@ -2651,8 +2651,8 @@ paths:
metadata: {}
last_sign_in_at:
current_sign_in_at:
- created_at: '2026-05-23T20:23:04.819Z'
- updated_at: '2026-05-23T20:23:05.094Z'
+ created_at: '2026-05-24T16:07:17.823Z'
+ updated_at: '2026-05-24T16:07:18.154Z'
sign_in_count: 0
failed_attempts: 0
last_sign_in_ip:
@@ -2929,11 +2929,11 @@ paths:
example:
data:
- id: exp_UkLWZg9DAJ
- number: EF267401462
+ number: EF233476418
type: Spree::Exports::Products
format: csv
- created_at: '2026-05-23T20:23:07.517Z'
- updated_at: '2026-05-23T20:23:07.517Z'
+ created_at: '2026-05-24T16:07:20.612Z'
+ updated_at: '2026-05-24T16:07:20.612Z'
user_id: admin_UkLWZg9DAJ
done: false
filename:
@@ -3000,11 +3000,11 @@ paths:
application/json:
example:
id: exp_gbHJdmfrXB
- number: EF133911710
+ number: EF370959206
type: Spree::Exports::Products
format: csv
- created_at: '2026-05-23T20:23:07.805Z'
- updated_at: '2026-05-23T20:23:07.805Z'
+ created_at: '2026-05-24T16:07:20.906Z'
+ updated_at: '2026-05-24T16:07:20.906Z'
user_id: admin_UkLWZg9DAJ
done: false
filename:
@@ -3091,11 +3091,11 @@ paths:
application/json:
example:
id: exp_UkLWZg9DAJ
- number: EF777711529
+ number: EF216650102
type: Spree::Exports::Products
format: csv
- created_at: '2026-05-23T20:23:08.071Z'
- updated_at: '2026-05-23T20:23:08.071Z'
+ created_at: '2026-05-24T16:07:21.176Z'
+ updated_at: '2026-05-24T16:07:21.176Z'
user_id: admin_UkLWZg9DAJ
done: false
filename:
@@ -3278,8 +3278,8 @@ paths:
codes_count: 2
currency: USD
prefix: WELCOME
- created_at: '2026-05-23T20:23:08.665Z'
- updated_at: '2026-05-23T20:23:08.665Z'
+ created_at: '2026-05-24T16:07:21.771Z'
+ updated_at: '2026-05-24T16:07:21.771Z'
amount: '50.0'
expires_at:
created_by_id:
@@ -3360,8 +3360,8 @@ paths:
codes_count: 5
currency: USD
prefix: NEWCAMP
- created_at: '2026-05-23T20:23:09.227Z'
- updated_at: '2026-05-23T20:23:09.227Z'
+ created_at: '2026-05-24T16:07:22.330Z'
+ updated_at: '2026-05-24T16:07:22.330Z'
amount: '25.0'
expires_at: '2030-12-31'
created_by_id: admin_UkLWZg9DAJ
@@ -3462,8 +3462,8 @@ paths:
codes_count: 2
currency: USD
prefix: WELCOME
- created_at: '2026-05-23T20:23:09.510Z'
- updated_at: '2026-05-23T20:23:09.510Z'
+ created_at: '2026-05-24T16:07:22.613Z'
+ updated_at: '2026-05-24T16:07:22.613Z'
amount: '50.0'
expires_at:
created_by_id:
@@ -3566,7 +3566,7 @@ paths:
example:
data:
- id: gc_UkLWZg9DAJ
- code: B9147647BE7F49C9
+ code: 36A3AB445CD03FD3
status: active
currency: USD
amount: '50.0'
@@ -3580,12 +3580,12 @@ paths:
redeemed_at:
expired: false
active: true
- created_at: '2026-05-23T20:23:10.070Z'
- updated_at: '2026-05-23T20:23:10.070Z'
+ created_at: '2026-05-24T16:07:23.175Z'
+ updated_at: '2026-05-24T16:07:23.175Z'
customer_id:
created_by_id:
- id: gc_gbHJdmfrXB
- code: A3003435E64008E5
+ code: 4B6931971190EBEC
status: active
currency: USD
amount: '25.0'
@@ -3599,8 +3599,8 @@ paths:
redeemed_at:
expired: false
active: true
- created_at: '2026-05-23T20:23:10.071Z'
- updated_at: '2026-05-23T20:23:10.071Z'
+ created_at: '2026-05-24T16:07:23.176Z'
+ updated_at: '2026-05-24T16:07:23.176Z'
customer_id:
created_by_id:
meta:
@@ -3685,7 +3685,7 @@ paths:
application/json:
example:
id: gc_EfhxLZ9ck8
- code: CA0A68D97ABF5FF1
+ code: 2F07C05FFF93AF20
status: active
currency: USD
amount: '25.0'
@@ -3699,8 +3699,8 @@ paths:
redeemed_at:
expired: false
active: true
- created_at: '2026-05-23T20:23:10.638Z'
- updated_at: '2026-05-23T20:23:10.638Z'
+ created_at: '2026-05-24T16:07:23.742Z'
+ updated_at: '2026-05-24T16:07:23.742Z'
customer_id:
created_by_id: admin_UkLWZg9DAJ
schema:
@@ -3806,7 +3806,7 @@ paths:
application/json:
example:
id: gc_UkLWZg9DAJ
- code: FBA856AAA98550B1
+ code: 7168AAC2F84B7AA1
status: active
currency: USD
amount: '50.0'
@@ -3820,8 +3820,8 @@ paths:
redeemed_at:
expired: false
active: true
- created_at: '2026-05-23T20:23:10.923Z'
- updated_at: '2026-05-23T20:23:10.923Z'
+ created_at: '2026-05-24T16:07:24.025Z'
+ updated_at: '2026-05-24T16:07:24.025Z'
customer_id:
created_by_id:
schema:
@@ -3881,7 +3881,7 @@ paths:
application/json:
example:
id: gc_UkLWZg9DAJ
- code: 2C1AB40149607C60
+ code: D0D09ACDE8C8E02F
status: active
currency: USD
amount: '75.0'
@@ -3895,8 +3895,8 @@ paths:
redeemed_at:
expired: false
active: true
- created_at: '2026-05-23T20:23:11.476Z'
- updated_at: '2026-05-23T20:23:11.750Z'
+ created_at: '2026-05-24T16:07:24.579Z'
+ updated_at: '2026-05-24T16:07:24.858Z'
customer_id:
created_by_id:
schema:
@@ -4008,15 +4008,15 @@ paths:
example:
data:
- id: inv_UkLWZg9DAJ
status: pending
- created_at: '2026-05-23T20:23:12.596Z'
- updated_at: '2026-05-23T20:23:12.596Z'
- expires_at: '2026-06-06T20:23:12.594Z'
+ created_at: '2026-05-24T16:07:25.707Z'
+ updated_at: '2026-05-24T16:07:25.707Z'
+ expires_at: '2026-06-07T16:07:25.705Z'
role_id: role_UkLWZg9DAJ
role_name: admin
- inviter_email: [email protected]
- acceptance_url: "/accept-invitation/inv_UkLWZg9DAJ?token=sCX5MxRGjYypwTN6WvHLpibh"
+ inviter_email: [email protected]
+ acceptance_url: "/accept-invitation/inv_UkLWZg9DAJ?token=E8YpGtYZWDtA9iU3YTpJRMpf"
invitee_exists: false
store:
id: store_UkLWZg9DAJ
@@ -4077,13 +4077,13 @@ paths:
id: inv_gbHJdmfrXB
status: pending
- created_at: '2026-05-23T20:23:12.893Z'
- updated_at: '2026-05-23T20:23:12.893Z'
- expires_at: '2026-06-06T20:23:12.891Z'
+ created_at: '2026-05-24T16:07:26.003Z'
+ updated_at: '2026-05-24T16:07:26.003Z'
+ expires_at: '2026-06-07T16:07:26.001Z'
role_id: role_UkLWZg9DAJ
role_name: admin
- inviter_email: [email protected]
- acceptance_url: "/accept-invitation/inv_gbHJdmfrXB?token=4EwsJNndar2vUnnpdNbU1pPd"
+ inviter_email: [email protected]
+ acceptance_url: "/accept-invitation/inv_gbHJdmfrXB?token=FjFn64HfboErT1Tvyfuq8krZ"
invitee_exists: false
store:
id: store_UkLWZg9DAJ
@@ -4190,15 +4190,15 @@ paths:
application/json:
example:
id: inv_UkLWZg9DAJ
status: pending
- created_at: '2026-05-23T20:23:13.441Z'
- updated_at: '2026-05-23T20:23:13.441Z'
- expires_at: '2026-06-06T20:23:13.439Z'
+ created_at: '2026-05-24T16:07:26.548Z'
+ updated_at: '2026-05-24T16:07:26.548Z'
+ expires_at: '2026-06-07T16:07:26.546Z'
role_id: role_UkLWZg9DAJ
role_name: admin
- inviter_email: [email protected]
- acceptance_url: "/accept-invitation/inv_UkLWZg9DAJ?token=nFRc97ZBRjcNwqzvUD3PPAWF"
+ inviter_email: [email protected]
+ acceptance_url: "/accept-invitation/inv_UkLWZg9DAJ?token=xB4SfDNKgsviBVABPoWaf2AM"
invitee_exists: false
store:
id: store_UkLWZg9DAJ
@@ -4248,12 +4248,12 @@ paths:
example:
user:
id: admin_UkLWZg9DAJ
- first_name: Luther
- last_name: Kautzer
- full_name: Luther Kautzer
- created_at: '2026-05-23T20:23:13.713Z'
- updated_at: '2026-05-23T20:23:13.713Z'
+ first_name: Glenn
+ last_name: Pagac
+ full_name: Glenn Pagac
+ created_at: '2026-05-24T16:07:26.822Z'
+ updated_at: '2026-05-24T16:07:26.822Z'
roles:
- id: role_UkLWZg9DAJ
name: admin
@@ -4403,8 +4403,8 @@ paths:
kind: dropdown
metadata: {}
filterable: true
- created_at: '2026-05-23T20:23:13.755Z'
- updated_at: '2026-05-23T20:23:13.755Z'
+ created_at: '2026-05-24T16:07:26.862Z'
+ updated_at: '2026-05-24T16:07:26.862Z'
meta:
page: 1
limit: 25
@@ -4495,8 +4495,8 @@ paths:
kind: dropdown
metadata: {}
filterable: true
- created_at: '2026-05-23T20:23:14.319Z'
- updated_at: '2026-05-23T20:23:14.319Z'
+ created_at: '2026-05-24T16:07:27.427Z'
+ updated_at: '2026-05-24T16:07:27.427Z'
schema:
"$ref": "#/components/schemas/OptionType"
'422':
@@ -4617,8 +4617,8 @@ paths:
kind: dropdown
metadata: {}
filterable: true
- created_at: '2026-05-23T20:23:14.599Z'
- updated_at: '2026-05-23T20:23:14.599Z'
+ created_at: '2026-05-24T16:07:27.708Z'
+ updated_at: '2026-05-24T16:07:27.708Z'
schema:
"$ref": "#/components/schemas/OptionType"
'404':
@@ -4690,8 +4690,8 @@ paths:
kind: dropdown
metadata: {}
filterable: true
- created_at: '2026-05-23T20:23:15.173Z'
- updated_at: '2026-05-23T20:23:15.449Z'
+ created_at: '2026-05-24T16:07:28.273Z'
+ updated_at: '2026-05-24T16:07:28.551Z'
schema:
"$ref": "#/components/schemas/OptionType"
'422':
@@ -4850,7 +4850,7 @@ paths:
example:
data:
- id: ful_UkLWZg9DAJ
- number: H51530983034
+ number: H29439624496
tracking: U10000
tracking_url:
cost: '10.0'
@@ -4875,8 +4875,8 @@ paths:
metadata: {}
adjustment_total: '0.0'
pre_tax_amount: '0.0'
- created_at: '2026-05-23T20:23:16.365Z'
- updated_at: '2026-05-23T20:23:16.461Z'
+ created_at: '2026-05-24T16:07:29.470Z'
+ updated_at: '2026-05-24T16:07:29.566Z'
order_id: or_UkLWZg9DAJ
stock_location_id: sloc_UkLWZg9DAJ
meta:
@@ -4959,7 +4959,7 @@ paths:
application/json:
example:
id: ful_UkLWZg9DAJ
- number: H31976892409
+ number: H83838959712
tracking: U10000
tracking_url:
cost: '10.0'
@@ -4984,8 +4984,8 @@ paths:
metadata: {}
adjustment_total: '0.0'
pre_tax_amount: '0.0'
- created_at: '2026-05-23T20:23:17.056Z'
- updated_at: '2026-05-23T20:23:17.107Z'
+ created_at: '2026-05-24T16:07:30.167Z'
+ updated_at: '2026-05-24T16:07:30.223Z'
order_id: or_UkLWZg9DAJ
stock_location_id: sloc_UkLWZg9DAJ
patch:
@@ -5044,7 +5044,7 @@ paths:
application/json:
example:
id: ful_UkLWZg9DAJ
- number: H97898464069
+ number: H69901305325
tracking: 1Z999AA10123456784
tracking_url: https://wwwapps.ups.com/WebTracking/track?track=yes&trackNums=1Z999AA10123456784
cost: '10.0'
@@ -5069,8 +5069,8 @@ paths:
metadata: {}
adjustment_total: '0.0'
pre_tax_amount: '0.0'
- created_at: '2026-05-23T20:23:17.685Z'
- updated_at: '2026-05-23T20:23:18.012Z'
+ created_at: '2026-05-24T16:07:30.804Z'
+ updated_at: '2026-05-24T16:07:31.130Z'
order_id: or_UkLWZg9DAJ
stock_location_id: sloc_UkLWZg9DAJ
requestBody:
@@ -5139,7 +5139,7 @@ paths:
application/json:
example:
id: ful_UkLWZg9DAJ
- number: H31110925967
+ number: H80385763066
tracking: U10000
tracking_url:
cost: '10.0'
@@ -5156,7 +5156,7 @@ paths:
display_tax_total: "$0.00"
status: shipped
fulfillment_type: shipping
- fulfilled_at: '2026-05-23T20:23:18Z'
+ fulfilled_at: '2026-05-24T16:07:31Z'
items:
- item_id: li_UkLWZg9DAJ
variant_id: variant_UkLWZg9DAJ
@@ -5164,8 +5164,8 @@ paths:
metadata: {}
adjustment_total: '0.0'
pre_tax_amount: '0.0'
- created_at: '2026-05-23T20:23:18.336Z'
- updated_at: '2026-05-23T20:23:18.672Z'
+ created_at: '2026-05-24T16:07:31.456Z'
+ updated_at: '2026-05-24T16:07:31.788Z'
order_id: or_UkLWZg9DAJ
stock_location_id: sloc_UkLWZg9DAJ
"/api/v3/admin/orders/{order_id}/fulfillments/{id}/cancel":
@@ -5223,7 +5223,7 @@ paths:
application/json:
example:
id: ful_UkLWZg9DAJ
- number: H06075878808
+ number: H37676325549
tracking: U10000
tracking_url:
cost: '10.0'
@@ -5248,8 +5248,8 @@ paths:
metadata: {}
adjustment_total: '0.0'
pre_tax_amount: '0.0'
- created_at: '2026-05-23T20:23:18.985Z'
- updated_at: '2026-05-23T20:23:19.311Z'
+ created_at: '2026-05-24T16:07:32.098Z'
+ updated_at: '2026-05-24T16:07:32.428Z'
order_id: or_UkLWZg9DAJ
stock_location_id: sloc_UkLWZg9DAJ
"/api/v3/admin/orders/{order_id}/fulfillments/{id}/resume":
@@ -5307,7 +5307,7 @@ paths:
application/json:
example:
id: ful_UkLWZg9DAJ
- number: H48807165525
+ number: H81294732686
tracking: U10000
tracking_url:
cost: '10.0'
@@ -5332,8 +5332,8 @@ paths:
metadata: {}
adjustment_total: '0.0'
pre_tax_amount: '0.0'
- created_at: '2026-05-23T20:23:19.625Z'
- updated_at: '2026-05-23T20:23:19.978Z'
+ created_at: '2026-05-24T16:07:32.742Z'
+ updated_at: '2026-05-24T16:07:33.097Z'
order_id: or_UkLWZg9DAJ
stock_location_id: sloc_UkLWZg9DAJ
"/api/v3/admin/orders/{order_id}/fulfillments/{id}/split":
@@ -5394,7 +5394,7 @@ paths:
example:
data:
- id: ful_gbHJdmfrXB
- number: H88966183137
+ number: H19611242098
tracking:
tracking_url:
cost: '10.0'
@@ -5419,8 +5419,8 @@ paths:
metadata: {}
adjustment_total: '0.0'
pre_tax_amount: '0.0'
- created_at: '2026-05-23T20:23:20.626Z'
- updated_at: '2026-05-23T20:23:20.664Z'
+ created_at: '2026-05-24T16:07:33.749Z'
+ updated_at: '2026-05-24T16:07:33.787Z'
order_id: or_UkLWZg9DAJ
stock_location_id: sloc_gbHJdmfrXB
requestBody:
@@ -5492,7 +5492,7 @@ paths:
application/json:
example:
id: gc_UkLWZg9DAJ
- code: EF2E97667EED0FE9
+ code: E193350025664BCA
status: active
currency: USD
amount: '10.0'
@@ -5506,8 +5506,8 @@ paths:
redeemed_at:
expired: false
active: true
- created_at: '2026-05-23T20:23:21.002Z'
- updated_at: '2026-05-23T20:23:21.293Z'
+ created_at: '2026-05-24T16:07:34.126Z'
+ updated_at: '2026-05-24T16:07:34.416Z'
customer_id:
created_by_id:
requestBody:
@@ -5640,8 +5640,8 @@ paths:
variant_id: variant_gbHJdmfrXB
quantity: 2
currency: USD
- name: Product 102105
- slug: product-102105
+ name: Product 104290
+ slug: product-104290
options_text: 'Size: S'
price: '10.0'
display_price: "$10.00"
@@ -5673,12 +5673,12 @@ paths:
option_type_label: Size
image_url:
metadata: {}
- created_at: '2026-05-23T20:23:21.952Z'
- updated_at: '2026-05-23T20:23:21.952Z'
+ created_at: '2026-05-24T16:07:35.074Z'
+ updated_at: '2026-05-24T16:07:35.074Z'
digital_links: []
metadata: {}
- created_at: '2026-05-23T20:23:22.234Z'
- updated_at: '2026-05-23T20:23:22.234Z'
+ created_at: '2026-05-24T16:07:35.355Z'
+ updated_at: '2026-05-24T16:07:35.355Z'
cost_price: '17.0'
tax_category_id: taxcat_UkLWZg9DAJ
meta:
@@ -5745,8 +5745,8 @@ paths:
variant_id: variant_VqXmZF31wY
quantity: 3
currency: USD
- name: Product 127433
- slug: product-127433
+ name: Product 124792
+ slug: product-124792
options_text: 'Size: S'
price: '19.99'
display_price: "$19.99"
@@ -5778,12 +5778,12 @@ paths:
option_type_label: Size
image_url:
metadata: {}
- created_at: '2026-05-23T20:23:23.145Z'
- updated_at: '2026-05-23T20:23:23.145Z'
+ created_at: '2026-05-24T16:07:36.297Z'
+ updated_at: '2026-05-24T16:07:36.297Z'
digital_links: []
metadata: {}
- created_at: '2026-05-23T20:23:23.176Z'
- updated_at: '2026-05-23T20:23:23.176Z'
+ created_at: '2026-05-24T16:07:36.327Z'
+ updated_at: '2026-05-24T16:07:36.327Z'
cost_price: '17.0'
tax_category_id: taxcat_UkLWZg9DAJ
requestBody:
@@ -5872,8 +5872,8 @@ paths:
variant_id: variant_gbHJdmfrXB
quantity: 2
currency: USD
- name: Product 13190
- slug: product-13190
+ name: Product 131664
+ slug: product-131664
options_text: 'Size: S'
price: '10.0'
display_price: "$10.00"
@@ -5905,12 +5905,12 @@ paths:
option_type_label: Size
image_url:
metadata: {}
- created_at: '2026-05-23T20:23:23.245Z'
- updated_at: '2026-05-23T20:23:23.245Z'
+ created_at: '2026-05-24T16:07:36.395Z'
+ updated_at: '2026-05-24T16:07:36.395Z'
digital_links: []
metadata: {}
- created_at: '2026-05-23T20:23:23.526Z'
- updated_at: '2026-05-23T20:23:23.526Z'
+ created_at: '2026-05-24T16:07:36.675Z'
+ updated_at: '2026-05-24T16:07:36.675Z'
cost_price: '17.0'
tax_category_id: taxcat_UkLWZg9DAJ
patch:
@@ -5972,8 +5972,8 @@ paths:
variant_id: variant_gbHJdmfrXB
quantity: 5
currency: USD
- name: Product 147202
- slug: product-147202
+ name: Product 14689
+ slug: product-14689
options_text: 'Size: S'
price: '19.99'
display_price: "$19.99"
@@ -6005,12 +6005,12 @@ paths:
option_type_label: Size
image_url:
metadata: {}
- created_at: '2026-05-23T20:23:23.841Z'
- updated_at: '2026-05-23T20:23:23.841Z'
+ created_at: '2026-05-24T16:07:36.995Z'
+ updated_at: '2026-05-24T16:07:36.995Z'
digital_links: []
metadata: {}
- created_at: '2026-05-23T20:23:24.123Z'
- updated_at: '2026-05-23T20:23:24.415Z'
+ created_at: '2026-05-24T16:07:37.277Z'
+ updated_at: '2026-05-24T16:07:37.567Z'
cost_price: '17.0'
tax_category_id: taxcat_UkLWZg9DAJ
requestBody:
@@ -6136,8 +6136,8 @@ paths:
data:
- id: py_UkLWZg9DAJ
payment_method_id: pm_UkLWZg9DAJ
- response_code: BGS-4e943d0db478
- number: PVFWLCVC
+ response_code: BGS-173440ebae32
+ number: PZG9SQC1
amount: '110.0'
display_amount: "$110.00"
status: completed
@@ -6155,14 +6155,14 @@ paths:
customer_id:
payment_method_id: pm_gbHJdmfrXB
metadata: {}
- created_at: '2026-05-23T20:23:25.384Z'
- updated_at: '2026-05-23T20:23:25.386Z'
+ created_at: '2026-05-24T16:07:38.611Z'
+ updated_at: '2026-05-24T16:07:38.613Z'
metadata: {}
avs_response:
cvv_response_code:
cvv_response_message:
- created_at: '2026-05-23T20:23:25.385Z'
- updated_at: '2026-05-23T20:23:25.385Z'
+ created_at: '2026-05-24T16:07:38.612Z'
+ updated_at: '2026-05-24T16:07:38.612Z'
captured_amount: '0.0'
order_id: or_UkLWZg9DAJ
meta:
@@ -6229,7 +6229,7 @@ paths:
id: py_gbHJdmfrXB
payment_method_id: pm_EfhxLZ9ck8
response_code:
- number: PUOPKNXR
+ number: P2JL7J69
amount: '110.0'
display_amount: "$110.00"
status: checkout
@@ -6240,8 +6240,8 @@ paths:
avs_response:
cvv_response_code:
cvv_response_message:
- created_at: '2026-05-23T20:23:26.675Z'
- updated_at: '2026-05-23T20:23:26.675Z'
+ created_at: '2026-05-24T16:07:39.874Z'
+ updated_at: '2026-05-24T16:07:39.874Z'
captured_amount: '0.0'
order_id: or_gbHJdmfrXB
requestBody:
@@ -6331,8 +6331,8 @@ paths:
example:
id: py_UkLWZg9DAJ
payment_method_id: pm_UkLWZg9DAJ
- response_code: BGS-f9ebd9649c61
- number: PRL1K3BF
+ response_code: BGS-55266ffc343e
+ number: P2OSLWV1
amount: '110.0'
display_amount: "$110.00"
status: completed
@@ -6350,14 +6350,14 @@ paths:
customer_id:
payment_method_id: pm_gbHJdmfrXB
metadata: {}
- created_at: '2026-05-23T20:23:27.034Z'
- updated_at: '2026-05-23T20:23:27.036Z'
+ created_at: '2026-05-24T16:07:40.239Z'
+ updated_at: '2026-05-24T16:07:40.242Z'
metadata: {}
avs_response:
cvv_response_code:
cvv_response_message:
- created_at: '2026-05-23T20:23:27.035Z'
- updated_at: '2026-05-23T20:23:27.035Z'
+ created_at: '2026-05-24T16:07:40.241Z'
+ updated_at: '2026-05-24T16:07:40.241Z'
captured_amount: '0.0'
order_id: or_UkLWZg9DAJ
"/api/v3/admin/orders/{order_id}/payments/{id}/capture":
@@ -6416,8 +6416,8 @@ paths:
example:
id: py_UkLWZg9DAJ
payment_method_id: pm_UkLWZg9DAJ
- response_code: BGS-1ef8cceeecf5
- number: PJL2TC0C
+ response_code: BGS-3397499ee932
+ number: PSUF4BE3
amount: '110.0'
display_amount: "$110.00"
status: completed
@@ -6435,14 +6435,14 @@ paths:
customer_id:
payment_method_id: pm_gbHJdmfrXB
metadata: {}
- created_at: '2026-05-23T20:23:27.732Z'
- updated_at: '2026-05-23T20:23:27.736Z'
+ created_at: '2026-05-24T16:07:40.888Z'
+ updated_at: '2026-05-24T16:07:40.891Z'
metadata: {}
avs_response:
cvv_response_code:
cvv_response_message:
- created_at: '2026-05-23T20:23:27.735Z'
- updated_at: '2026-05-23T20:23:28.071Z'
+ created_at: '2026-05-24T16:07:40.890Z'
+ updated_at: '2026-05-24T16:07:41.213Z'
captured_amount: '110.0'
order_id: or_UkLWZg9DAJ
'422':
@@ -6511,8 +6511,8 @@ paths:
example:
id: py_UkLWZg9DAJ
payment_method_id: pm_UkLWZg9DAJ
- response_code: void-BGS-9fc033829c8c
- number: PPWKEI72
+ response_code: void-BGS-50bc9389ca6e
+ number: PLOX73YH
amount: '110.0'
display_amount: "$110.00"
status: void
@@ -6530,14 +6530,14 @@ paths:
customer_id:
payment_method_id: pm_gbHJdmfrXB
metadata: {}
- created_at: '2026-05-23T20:23:29.119Z'
- updated_at: '2026-05-23T20:23:29.121Z'
+ created_at: '2026-05-24T16:07:42.245Z'
+ updated_at: '2026-05-24T16:07:42.248Z'
metadata: {}
avs_response:
cvv_response_code:
cvv_response_message:
- created_at: '2026-05-23T20:23:29.120Z'
- updated_at: '2026-05-23T20:23:29.419Z'
+ created_at: '2026-05-24T16:07:42.247Z'
+ updated_at: '2026-05-24T16:07:42.543Z'
captured_amount: '0.0'
order_id: or_UkLWZg9DAJ
"/api/v3/admin/orders/{order_id}/refunds":
@@ -6665,14 +6665,14 @@ paths:
application/json:
example:
id: re_UkLWZg9DAJ
- transaction_id: BGS-874b8426dc28
+ transaction_id: BGS-186e46022de7
amount: '5.0'
payment_id: py_UkLWZg9DAJ
refund_reason_id: rr_UkLWZg9DAJ
reimbursement_id:
metadata: {}
- created_at: '2026-05-23T20:23:30.790Z'
- updated_at: '2026-05-23T20:23:30.790Z'
+ created_at: '2026-05-24T16:07:43.838Z'
+ updated_at: '2026-05-24T16:07:43.838Z'
requestBody:
content:
application/json:
@@ -6744,8 +6744,8 @@ paths:
id: or_UkLWZg9DAJ
market_id:
channel_id: ch_UkLWZg9DAJ
- number: R020010018
+ number: R442690853
customer_note:
currency: USD
locale: en
@@ -6788,8 +6788,8 @@ paths:
metadata: {}
canceled_at:
approved_at:
- created_at: '2026-05-23T20:23:31.082Z'
- updated_at: '2026-05-23T20:23:31.133Z'
+ created_at: '2026-05-24T16:07:44.132Z'
+ updated_at: '2026-05-24T16:07:44.180Z'
preferred_stock_location_id:
tags: []
internal_note:
@@ -6960,8 +6960,8 @@ paths:
- id: or_UkLWZg9DAJ
market_id:
channel_id: ch_UkLWZg9DAJ
- number: R327694725
+ number: R637716082
customer_note:
currency: USD
locale: en
@@ -7004,8 +7004,8 @@ paths:
metadata: {}
canceled_at:
approved_at:
- created_at: '2026-05-23T20:23:32.856Z'
- updated_at: '2026-05-23T20:23:32.856Z'
+ created_at: '2026-05-24T16:07:45.897Z'
+ updated_at: '2026-05-24T16:07:45.897Z'
preferred_stock_location_id:
tags: []
internal_note:
@@ -7148,7 +7148,7 @@ paths:
id: or_gbHJdmfrXB
market_id:
channel_id: ch_UkLWZg9DAJ
- number: R198266154
+ number: R305907575
customer_note:
currency: USD
@@ -7192,8 +7192,8 @@ paths:
metadata: {}
canceled_at:
approved_at:
- created_at: '2026-05-23T20:23:34.534Z'
- updated_at: '2026-05-23T20:23:34.536Z'
+ created_at: '2026-05-24T16:07:47.635Z'
+ updated_at: '2026-05-24T16:07:47.638Z'
preferred_stock_location_id: sloc_UkLWZg9DAJ
tags: []
internal_note:
@@ -7377,8 +7377,8 @@ paths:
id: or_UkLWZg9DAJ
market_id:
channel_id: ch_UkLWZg9DAJ
- number: R625912109
+ number: R724692708
customer_note:
currency: USD
locale: en
@@ -7421,8 +7421,8 @@ paths:
metadata: {}
canceled_at:
approved_at:
- created_at: '2026-05-23T20:23:34.811Z'
- updated_at: '2026-05-23T20:23:34.811Z'
+ created_at: '2026-05-24T16:07:47.911Z'
+ updated_at: '2026-05-24T16:07:47.911Z'
preferred_stock_location_id:
tags: []
internal_note:
@@ -7493,7 +7493,7 @@ paths:
id: or_UkLWZg9DAJ
market_id:
channel_id: ch_UkLWZg9DAJ
- number: R284304927
+ number: R220970132
customer_note:
currency: USD
@@ -7537,8 +7537,8 @@ paths:
metadata: {}
canceled_at:
approved_at:
- created_at: '2026-05-23T20:23:35.903Z'
- updated_at: '2026-05-23T20:23:36.185Z'
+ created_at: '2026-05-24T16:07:49.005Z'
+ updated_at: '2026-05-24T16:07:49.287Z'
preferred_stock_location_id:
tags: []
internal_note:
@@ -7719,8 +7719,8 @@ paths:
id: or_UkLWZg9DAJ
market_id:
channel_id: ch_UkLWZg9DAJ
- number: R799312983
+ number: R814249271
customer_note:
currency: USD
locale: en
@@ -7747,7 +7747,7 @@ paths:
display_delivery_total: "$100.00"
fulfillment_status: ready
payment_status: paid
- completed_at: '2026-05-23T20:23:37.078Z'
+ completed_at: '2026-05-24T16:07:50.180Z'
store_credit_total: '0.0'
display_store_credit_total: "$0.00"
covered_by_store_credit: false
@@ -7763,8 +7763,8 @@ paths:
metadata: {}
canceled_at:
approved_at:
- created_at: '2026-05-23T20:23:37.028Z'
- updated_at: '2026-05-23T20:23:37.101Z'
+ created_at: '2026-05-24T16:07:50.131Z'
+ updated_at: '2026-05-24T16:07:50.202Z'
preferred_stock_location_id:
tags: []
internal_note:
@@ -7845,8 +7845,8 @@ paths:
id: or_UkLWZg9DAJ
market_id:
channel_id: ch_UkLWZg9DAJ
- number: R503466612
+ number: R681583939
customer_note:
currency: USD
locale: en
@@ -7873,7 +7873,7 @@ paths:
display_delivery_total: "$10.00"
fulfillment_status: canceled
payment_status: void
- completed_at: '2026-05-23T20:23:38.313Z'
+ completed_at: '2026-05-24T16:07:51.403Z'
store_credit_total: '0.0'
display_store_credit_total: "$0.00"
covered_by_store_credit: false
@@ -7887,10 +7887,10 @@ paths:
payment_total: '0.0'
display_payment_total: "$0.00"
metadata: {}
- canceled_at: '2026-05-23T20:23:38.611Z'
+ canceled_at: '2026-05-24T16:07:51.702Z'
approved_at:
- created_at: '2026-05-23T20:23:38.267Z'
- updated_at: '2026-05-23T20:23:38.650Z'
+ created_at: '2026-05-24T16:07:51.358Z'
+ updated_at: '2026-05-24T16:07:51.751Z'
preferred_stock_location_id:
tags: []
internal_note:
@@ -7949,8 +7949,8 @@ paths:
id: or_UkLWZg9DAJ
market_id:
channel_id: ch_UkLWZg9DAJ
- number: R400529958
+ number: R320278252
customer_note:
currency: USD
locale: en
@@ -7977,7 +7977,7 @@ paths:
display_delivery_total: "$100.00"
fulfillment_status:
payment_status:
- completed_at: '2026-05-23T20:23:38.994Z'
+ completed_at: '2026-05-24T16:07:52.103Z'
store_credit_total: '0.0'
display_store_credit_total: "$0.00"
covered_by_store_credit: false
@@ -7992,9 +7992,9 @@ paths:
display_payment_total: "$0.00"
metadata: {}
canceled_at:
- approved_at: '2026-05-23T20:23:39.280Z'
- created_at: '2026-05-23T20:23:38.947Z'
- updated_at: '2026-05-23T20:23:38.994Z'
+ approved_at: '2026-05-24T16:07:52.391Z'
+ created_at: '2026-05-24T16:07:52.048Z'
+ updated_at: '2026-05-24T16:07:52.103Z'
preferred_stock_location_id:
tags: []
internal_note:
@@ -8053,8 +8053,8 @@ paths:
id: or_UkLWZg9DAJ
market_id:
channel_id: ch_UkLWZg9DAJ
- number: R085379611
+ number: R243394763
customer_note:
currency: USD
locale: en
@@ -8081,7 +8081,7 @@ paths:
display_delivery_total: "$10.00"
fulfillment_status: canceled
payment_status: void
- completed_at: '2026-05-23T20:23:39.610Z'
+ completed_at: '2026-05-24T16:07:52.721Z'
store_credit_total: '0.0'
display_store_credit_total: "$0.00"
covered_by_store_credit: false
@@ -8095,10 +8095,10 @@ paths:
payment_total: '0.0'
display_payment_total: "$0.00"
metadata: {}
- canceled_at: '2026-05-23T20:23:39.932Z'
+ canceled_at: '2026-05-24T16:07:52.997Z'
approved_at:
- created_at: '2026-05-23T20:23:39.559Z'
- updated_at: '2026-05-23T20:23:40.062Z'
+ created_at: '2026-05-24T16:07:52.671Z'
+ updated_at: '2026-05-24T16:07:53.085Z'
preferred_stock_location_id:
tags: []
internal_note:
@@ -8157,8 +8157,8 @@ paths:
id: or_UkLWZg9DAJ
market_id:
channel_id: ch_UkLWZg9DAJ
- number: R203585508
+ number: R376624055
customer_note:
currency: USD
locale: en
@@ -8185,7 +8185,7 @@ paths:
display_delivery_total: "$100.00"
fulfillment_status:
payment_status:
- completed_at: '2026-05-23T20:23:40.407Z'
+ completed_at: '2026-05-24T16:07:53.413Z'
store_credit_total: '0.0'
display_store_credit_total: "$0.00"
covered_by_store_credit: false
@@ -8201,8 +8201,8 @@ paths:
metadata: {}
canceled_at:
approved_at:
- created_at: '2026-05-23T20:23:40.353Z'
- updated_at: '2026-05-23T20:23:40.407Z'
+ created_at: '2026-05-24T16:07:53.362Z'
+ updated_at: '2026-05-24T16:07:53.413Z'
preferred_stock_location_id:
tags: []
internal_note:
@@ -8277,8 +8277,8 @@ paths:
auto_capture:
storefront_visible: true
position: 1
- created_at: '2026-05-23T20:23:40.726Z'
- updated_at: '2026-05-23T20:23:40.727Z'
+ created_at: '2026-05-24T16:07:53.714Z'
+ updated_at: '2026-05-24T16:07:53.716Z'
preferences: {}
preference_schema: []
meta:
@@ -8418,8 +8418,8 @@ paths:
auto_capture:
storefront_visible: true
position: 1
- created_at: '2026-05-23T20:23:41.345Z'
- updated_at: '2026-05-23T20:23:41.346Z'
+ created_at: '2026-05-24T16:07:54.288Z'
+ updated_at: '2026-05-24T16:07:54.289Z'
preferences: {}
preference_schema: []
"/api/v3/admin/products/{product_id}/custom_fields":
@@ -8489,8 +8489,8 @@ paths:
field_type: short_text
key: custom.title
value: wool
- created_at: '2026-05-23T20:23:41.784Z'
- updated_at: '2026-05-23T20:23:41.784Z'
+ created_at: '2026-05-24T16:07:54.604Z'
+ updated_at: '2026-05-24T16:07:54.604Z'
storefront_visible: true
custom_field_definition_id: cfdef_UkLWZg9DAJ
meta:
@@ -8557,8 +8557,8 @@ paths:
field_type: long_text
key: custom.description
value: A longer description
- created_at: '2026-05-23T20:23:42.423Z'
- updated_at: '2026-05-23T20:23:42.423Z'
+ created_at: '2026-05-24T16:07:55.272Z'
+ updated_at: '2026-05-24T16:07:55.272Z'
storefront_visible: true
custom_field_definition_id: cfdef_gbHJdmfrXB
'422':
@@ -8642,8 +8642,8 @@ paths:
field_type: short_text
key: custom.title
value: wool
- created_at: '2026-05-23T20:23:42.795Z'
- updated_at: '2026-05-23T20:23:42.795Z'
+ created_at: '2026-05-24T16:07:55.622Z'
+ updated_at: '2026-05-24T16:07:55.622Z'
storefront_visible: true
custom_field_definition_id: cfdef_UkLWZg9DAJ
patch:
@@ -8690,8 +8690,8 @@ paths:
field_type: short_text
key: custom.title
value: cotton
- created_at: '2026-05-23T20:23:43.132Z'
- updated_at: '2026-05-23T20:23:43.415Z'
+ created_at: '2026-05-24T16:07:55.932Z'
+ updated_at: '2026-05-24T16:07:56.209Z'
storefront_visible: true
custom_field_definition_id: cfdef_UkLWZg9DAJ
requestBody:
@@ -8829,34 +8829,34 @@ paths:
example:
data:
- id: prod_UkLWZg9DAJ
- name: Product 399680
- slug: product-399680
+ name: Product 398433
+ slug: product-398433
meta_title:
meta_description:
meta_keywords:
variant_count: 0
- available_on: '2025-05-23T20:23:43.791Z'
+ available_on: '2025-05-24T16:07:56.533Z'
purchasable: true
in_stock: false
backorderable: true
available: true
- description: Exercitationem nulla maiores dignissimos aspernatur
- iste. Rem at laudantium nobis illo accusantium. Totam animi eaque
- minima pariatur aliquam. Similique deserunt consectetur corrupti
- unde aperiam. Modi incidunt ducimus sapiente est occaecati. A
- occaecati incidunt dicta magni error. Totam aspernatur voluptatum
- repellendus nemo delectus alias. Adipisci exercitationem quia
- corporis fugiat iste. Iusto porro facere in quo consequuntur repellat
- asperiores. Repellat nisi voluptatum laudantium in magnam. Iste
- expedita aliquid veritatis a doloribus magnam eligendi deleniti.
- In modi voluptate inventore id quidem omnis. Odit dignissimos
- veritatis consequatur modi. Nesciunt cumque illo harum nostrum
- laborum magnam inventore sint. Iusto ratione ipsam perferendis
- iste culpa suscipit.
+ description: Alias rerum error aspernatur accusamus ipsum repellendus
+ excepturi illo. Accusantium totam cum consequuntur vitae provident.
+ Itaque quis nihil quia laborum tempora perspiciatis voluptatum.
+ Id quod error deleniti quae sunt ullam laudantium facere. In autem
+ facere aliquid eum minus dolores numquam. Quod deleniti nam fugiat
+ et praesentium. Voluptate labore distinctio dolore reprehenderit.
+ Pariatur porro veritatis eius provident. Ipsa aliquid porro cumque
+ quisquam. Veniam minus rerum eos voluptatem. Iste ex cumque perferendis
+ nam. Placeat fugit sequi ipsum sint aperiam. Quam beatae voluptas
+ soluta rem. Rerum quam magnam aperiam sit. Dicta aspernatur veritatis
+ deserunt veniam distinctio. Quo cupiditate voluptatum nam optio
+ animi consequatur. Nostrum iure odio ipsa amet asperiores laborum.
description_html: |-
- Exercitationem nulla maiores dignissimos aspernatur iste. Rem at laudantium nobis illo accusantium. Totam animi eaque minima pariatur aliquam. Similique deserunt consectetur corrupti unde aperiam. Modi incidunt ducimus sapiente est occaecati.
- A occaecati incidunt dicta magni error. Totam aspernatur voluptatum repellendus nemo delectus alias. Adipisci exercitationem quia corporis fugiat iste. Iusto porro facere in quo consequuntur repellat asperiores. Repellat nisi voluptatum laudantium in magnam.
- Iste expedita aliquid veritatis a doloribus magnam eligendi deleniti. In modi voluptate inventore id quidem omnis. Odit dignissimos veritatis consequatur modi. Nesciunt cumque illo harum nostrum laborum magnam inventore sint. Iusto ratione ipsam perferendis iste culpa suscipit.
+ Alias rerum error aspernatur accusamus ipsum repellendus excepturi illo. Accusantium totam cum consequuntur vitae provident. Itaque quis nihil quia laborum tempora perspiciatis voluptatum. Id quod error deleniti quae sunt ullam laudantium facere.
+ In autem facere aliquid eum minus dolores numquam. Quod deleniti nam fugiat et praesentium. Voluptate labore distinctio dolore reprehenderit. Pariatur porro veritatis eius provident. Ipsa aliquid porro cumque quisquam.
+ Veniam minus rerum eos voluptatem. Iste ex cumque perferendis nam. Placeat fugit sequi ipsum sint aperiam.
+ Quam beatae voluptas soluta rem. Rerum quam magnam aperiam sit. Dicta aspernatur veritatis deserunt veniam distinctio. Quo cupiditate voluptatum nam optio animi consequatur. Nostrum iure odio ipsa amet asperiores laborum.
default_variant_id: variant_UkLWZg9DAJ
thumbnail_url:
tags: []
@@ -8871,16 +8871,16 @@ paths:
display_compare_at_amount:
price_list_id:
variant_id: variant_UkLWZg9DAJ
- created_at: '2026-05-23T20:23:43.823Z'
- updated_at: '2026-05-23T20:23:43.823Z'
+ created_at: '2026-05-24T16:07:56.560Z'
+ updated_at: '2026-05-24T16:07:56.560Z'
original_price:
status: active
- make_active_at: '2025-05-23T20:23:43.791Z'
+ make_active_at: '2025-05-24T16:07:56.533Z'
discontinue_on:
metadata: {}
deleted_at:
- created_at: '2026-05-23T20:23:43.807Z'
- updated_at: '2026-05-23T20:23:43.824Z'
+ created_at: '2026-05-24T16:07:56.547Z'
+ updated_at: '2026-05-24T16:07:56.561Z'
tax_category_id: taxcat_UkLWZg9DAJ
meta:
page: 1
@@ -9014,8 +9014,8 @@ paths:
discontinue_on:
metadata: {}
deleted_at:
- created_at: '2026-05-23T20:23:44.498Z'
- updated_at: '2026-05-23T20:23:44.500Z'
+ created_at: '2026-05-24T16:07:57.247Z'
+ updated_at: '2026-05-24T16:07:57.249Z'
tax_category_id:
schema:
"$ref": "#/components/schemas/Product"
@@ -9195,40 +9195,35 @@ paths:
application/json:
example:
id: prod_UkLWZg9DAJ
- name: Product 435231
- slug: product-435231
+ name: Product 431773
+ slug: product-431773
meta_title:
meta_description:
meta_keywords:
variant_count: 0
- available_on: '2025-05-23T20:23:44.856Z'
+ available_on: '2025-05-24T16:07:57.613Z'
purchasable: true
in_stock: false
backorderable: true
available: true
- description: Odit repellendus magnam quisquam adipisci perferendis
- hic dolores. Laudantium maiores ipsam vitae reprehenderit. Quod
- aperiam quasi velit perferendis fugiat sit exercitationem consectetur.
- Optio porro recusandae blanditiis odit. Voluptatum vel dicta perferendis
- corporis delectus amet odio. Commodi doloremque magnam voluptatum
- nihil assumenda. Repellat quo eos repudiandae voluptate numquam
- distinctio. Nemo officiis dolor impedit hic perferendis et quo.
- Laboriosam iure ipsam doloremque debitis suscipit tempora perspiciatis.
- Nihil commodi possimus maxime amet aliquid. Optio voluptatem magni
- deleniti quas inventore quis veniam. Laboriosam nulla accusantium
- atque debitis quaerat ipsam modi ratione. Commodi ab pariatur laborum
- ad. Dignissimos veritatis a nam neque ipsa exercitationem amet.
- Itaque aperiam quisquam voluptate soluta. Eius ratione illum est
- alias temporibus eum. Unde incidunt dolorem impedit sint adipisci
- dolorum dignissimos. Cumque consectetur voluptate architecto vitae
- id iste. Pariatur quasi laboriosam libero ipsum consequuntur. Placeat
- libero quo officiis adipisci voluptas fuga accusantium odio.
+ description: Natus consequuntur quas delectus autem beatae cumque
+ itaque officia. Nisi ducimus laudantium illum velit repellat animi.
+ Eum numquam a aut non. Dicta repudiandae occaecati eligendi nostrum
+ iure numquam ratione excepturi. Itaque saepe consequuntur pariatur
+ sint ex aspernatur consectetur. Quaerat sed maxime quasi veniam
+ vitae culpa architecto. Optio deleniti nihil quia corrupti ratione
+ ipsam. Quam voluptatem tempora animi eligendi saepe voluptatum repudiandae
+ molestias. Ducimus ut praesentium blanditiis unde deserunt facilis
+ perspiciatis architecto. Vitae deserunt consequuntur libero quisquam
+ eos sit. Officiis pariatur error velit a minus. Odit voluptatum
+ repellendus qui fugiat. Earum tenetur hic iste ipsum. Facilis tempore
+ distinctio dicta id vitae voluptates at. Dolorum magni error nisi
+ rem expedita accusamus.
description_html: |-
- Odit repellendus magnam quisquam adipisci perferendis hic dolores. Laudantium maiores ipsam vitae reprehenderit. Quod aperiam quasi velit perferendis fugiat sit exercitationem consectetur. Optio porro recusandae blanditiis odit.
- Voluptatum vel dicta perferendis corporis delectus amet odio. Commodi doloremque magnam voluptatum nihil assumenda. Repellat quo eos repudiandae voluptate numquam distinctio. Nemo officiis dolor impedit hic perferendis et quo. Laboriosam iure ipsam doloremque debitis suscipit tempora perspiciatis.
- Nihil commodi possimus maxime amet aliquid. Optio voluptatem magni deleniti quas inventore quis veniam. Laboriosam nulla accusantium atque debitis quaerat ipsam modi ratione.
- Commodi ab pariatur laborum ad. Dignissimos veritatis a nam neque ipsa exercitationem amet. Itaque aperiam quisquam voluptate soluta. Eius ratione illum est alias temporibus eum. Unde incidunt dolorem impedit sint adipisci dolorum dignissimos.
- Cumque consectetur voluptate architecto vitae id iste. Pariatur quasi laboriosam libero ipsum consequuntur. Placeat libero quo officiis adipisci voluptas fuga accusantium odio.
+ Natus consequuntur quas delectus autem beatae cumque itaque officia. Nisi ducimus laudantium illum velit repellat animi. Eum numquam a aut non.
+ Dicta repudiandae occaecati eligendi nostrum iure numquam ratione excepturi. Itaque saepe consequuntur pariatur sint ex aspernatur consectetur. Quaerat sed maxime quasi veniam vitae culpa architecto. Optio deleniti nihil quia corrupti ratione ipsam.
+ Quam voluptatem tempora animi eligendi saepe voluptatum repudiandae molestias. Ducimus ut praesentium blanditiis unde deserunt facilis perspiciatis architecto. Vitae deserunt consequuntur libero quisquam eos sit.
+ Officiis pariatur error velit a minus. Odit voluptatum repellendus qui fugiat. Earum tenetur hic iste ipsum. Facilis tempore distinctio dicta id vitae voluptates at. Dolorum magni error nisi rem expedita accusamus.
default_variant_id: variant_UkLWZg9DAJ
thumbnail_url:
tags: []
@@ -9243,16 +9238,16 @@ paths:
display_compare_at_amount:
price_list_id:
variant_id: variant_UkLWZg9DAJ
- created_at: '2026-05-23T20:23:44.890Z'
- updated_at: '2026-05-23T20:23:44.890Z'
+ created_at: '2026-05-24T16:07:57.637Z'
+ updated_at: '2026-05-24T16:07:57.637Z'
original_price:
status: active
- make_active_at: '2025-05-23T20:23:44.856Z'
+ make_active_at: '2025-05-24T16:07:57.613Z'
discontinue_on:
metadata: {}
deleted_at:
- created_at: '2026-05-23T20:23:44.873Z'
- updated_at: '2026-05-23T20:23:44.891Z'
+ created_at: '2026-05-24T16:07:57.626Z'
+ updated_at: '2026-05-24T16:07:57.638Z'
tax_category_id: taxcat_UkLWZg9DAJ
schema:
"$ref": "#/components/schemas/Product"
@@ -9319,35 +9314,22 @@ paths:
example:
id: prod_UkLWZg9DAJ
name: Updated Name
- slug: product-455481
+ slug: product-457387
meta_title:
meta_description:
meta_keywords:
variant_count: 0
- available_on: '2025-05-23T20:23:45.497Z'
+ available_on: '2025-05-24T16:07:58.260Z'
purchasable: true
in_stock: false
backorderable: true
available: true
- description: Et ratione sapiente dignissimos magnam praesentium sequi
- quidem. Consectetur praesentium harum id quis ipsum consequatur
- tenetur. In dolorem ducimus quis sint provident deserunt animi vero.
- Quae atque labore libero a. Omnis reiciendis numquam enim aut minima
- doloribus odit delectus. Aut iste laudantium pariatur ad accusamus.
- Ad temporibus ipsam earum mollitia. Fuga minima tenetur provident
- placeat laborum perferendis explicabo quaerat. Voluptatibus quibusdam
- atque quidem inventore architecto dolor placeat ab. Nostrum illum
- eligendi sunt ab maxime possimus. Repudiandae at aliquid illo aperiam.
- Porro laboriosam repellendus in unde ut atque accusamus. Dolores
- sint veniam quos quo. Nesciunt suscipit assumenda iure eum rerum
- facilis possimus. Quasi dignissimos unde quaerat eum odit nobis.
- Voluptatem eaque dicta fugiat consequatur harum molestias necessitatibus
- reiciendis.
- description_html: |-
- Et ratione sapiente dignissimos magnam praesentium sequi quidem. Consectetur praesentium harum id quis ipsum consequatur tenetur. In dolorem ducimus quis sint provident deserunt animi vero. Quae atque labore libero a.
- Omnis reiciendis numquam enim aut minima doloribus odit delectus. Aut iste laudantium pariatur ad accusamus. Ad temporibus ipsam earum mollitia. Fuga minima tenetur provident placeat laborum perferendis explicabo quaerat. Voluptatibus quibusdam atque quidem inventore architecto dolor placeat ab.
- Nostrum illum eligendi sunt ab maxime possimus. Repudiandae at aliquid illo aperiam. Porro laboriosam repellendus in unde ut atque accusamus.
- Dolores sint veniam quos quo. Nesciunt suscipit assumenda iure eum rerum facilis possimus. Quasi dignissimos unde quaerat eum odit nobis. Voluptatem eaque dicta fugiat consequatur harum molestias necessitatibus reiciendis.
+ description: Ducimus asperiores sint voluptatum aliquam vel. Repellendus
+ sapiente dicta magni quisquam aspernatur. Totam at iure alias repudiandae
+ voluptate incidunt doloribus.
+ description_html: Ducimus asperiores sint voluptatum aliquam vel.
+ Repellendus sapiente dicta magni quisquam aspernatur. Totam at iure
+ alias repudiandae voluptate incidunt doloribus.
default_variant_id: variant_UkLWZg9DAJ
thumbnail_url:
tags: []
@@ -9362,16 +9344,16 @@ paths:
display_compare_at_amount:
price_list_id:
variant_id: variant_UkLWZg9DAJ
- created_at: '2026-05-23T20:23:45.518Z'
- updated_at: '2026-05-23T20:23:45.518Z'
+ created_at: '2026-05-24T16:07:58.286Z'
+ updated_at: '2026-05-24T16:07:58.286Z'
original_price:
status: active
- make_active_at: '2025-05-23T20:23:45.497Z'
+ make_active_at: '2025-05-24T16:07:58.260Z'
discontinue_on:
metadata: {}
deleted_at:
- created_at: '2026-05-23T20:23:45.507Z'
- updated_at: '2026-05-23T20:23:45.807Z'
+ created_at: '2026-05-24T16:07:58.273Z'
+ updated_at: '2026-05-24T16:07:58.571Z'
tax_category_id: taxcat_UkLWZg9DAJ
schema:
"$ref": "#/components/schemas/Product"
@@ -9528,6 +9510,336 @@ paths:
responses:
'204':
description: product deleted
+ "/api/v3/admin/products/bulk_status_update":
+ post:
+ summary: Bulk-update product status
+ tags:
+ - Product Catalog
+ security:
+ - api_key: []
+ bearer_auth: []
+ description: |-
+ Sets `status` on each product in `ids`. Reindexes the affected products
+ for search. Cross-store IDs are silently dropped. Returns counts.
+
+
+ **Required scope:** `write_products` (for API-key authentication).
+ parameters:
+ - name: x-spree-api-key
+ in: header
+ required: true
+ schema:
+ type: string
+ - name: Authorization
+ in: header
+ required: true
+ schema:
+ type: string
+ responses:
+ '200':
+ description: cross-store products silently dropped
+ content:
+ application/json:
+ example:
+ product_count: 0
+ status: archived
+ schema:
+ type: object
+ properties:
+ product_count:
+ type: integer
+ status:
+ type: string
+ '422':
+ description: invalid status
+ content:
+ application/json:
+ example:
+ error:
+ code: invalid_status
+ message: Invalid status
+ schema:
+ "$ref": "#/components/schemas/ErrorResponse"
+ requestBody:
+ content:
+ application/json:
+ schema:
+ type: object
+ required:
+ - ids
+ - status
+ properties:
+ ids:
+ type: array
+ items:
+ type: string
+ example:
+ - prod_UkLWZg9DAJ
+ status:
+ type: string
+ enum:
+ - draft
+ - active
+ - archived
+ example: archived
+ "/api/v3/admin/products/bulk_add_to_categories":
+ post:
+ summary: Bulk-add products to categories
+ tags:
+ - Product Catalog
+ security:
+ - api_key: []
+ bearer_auth: []
+ description: |-
+ Attaches each product in `ids` to every category (taxon) in `category_ids`.
+ Categories from sibling stores are silently ignored.
+
+
+ **Required scope:** `write_products` (for API-key authentication).
+ parameters:
+ - name: x-spree-api-key
+ in: header
+ required: true
+ schema:
+ type: string
+ - name: Authorization
+ in: header
+ required: true
+ schema:
+ type: string
+ responses:
+ '200':
+ description: products added to categories
+ content:
+ application/json:
+ example:
+ product_count: 1
+ category_count: 1
+ schema:
+ type: object
+ properties:
+ product_count:
+ type: integer
+ category_count:
+ type: integer
+ requestBody:
+ content:
+ application/json:
+ schema:
+ type: object
+ required:
+ - ids
+ - category_ids
+ properties:
+ ids:
+ type: array
+ items:
+ type: string
+ category_ids:
+ type: array
+ items:
+ type: string
+ "/api/v3/admin/products/bulk_remove_from_categories":
+ post:
+ summary: Bulk-remove products from categories
+ tags:
+ - Product Catalog
+ security:
+ - api_key: []
+ bearer_auth: []
+ description: |-
+ Detaches each product in `ids` from every category in `category_ids`.
+
+ **Required scope:** `write_products` (for API-key authentication).
+ parameters:
+ - name: x-spree-api-key
+ in: header
+ required: true
+ schema:
+ type: string
+ - name: Authorization
+ in: header
+ required: true
+ schema:
+ type: string
+ responses:
+ '200':
+ description: products removed from categories
+ content:
+ application/json:
+ example:
+ product_count: 1
+ category_count: 1
+ requestBody:
+ content:
+ application/json:
+ schema:
+ type: object
+ required:
+ - ids
+ - category_ids
+ properties:
+ ids:
+ type: array
+ items:
+ type: string
+ category_ids:
+ type: array
+ items:
+ type: string
+ "/api/v3/admin/products/bulk_add_tags":
+ post:
+ summary: Bulk-add tags to products
+ tags:
+ - Product Catalog
+ security:
+ - api_key: []
+ bearer_auth: []
+ description: |-
+ Adds each tag name in `tags` to every product in `ids`. Tags are upserted by name.
+
+ **Required scope:** `write_products` (for API-key authentication).
+ parameters:
+ - name: x-spree-api-key
+ in: header
+ required: true
+ schema:
+ type: string
+ - name: Authorization
+ in: header
+ required: true
+ schema:
+ type: string
+ responses:
+ '200':
+ description: tags added
+ content:
+ application/json:
+ example:
+ product_count: 1
+ tag_count: 2
+ schema:
+ type: object
+ properties:
+ product_count:
+ type: integer
+ tag_count:
+ type: integer
+ requestBody:
+ content:
+ application/json:
+ schema:
+ type: object
+ required:
+ - ids
+ - tags
+ properties:
+ ids:
+ type: array
+ items:
+ type: string
+ tags:
+ type: array
+ items:
+ type: string
+ example:
+ - summer
+ - sale
+ "/api/v3/admin/products/bulk_remove_tags":
+ post:
+ summary: Bulk-remove tags from products
+ tags:
+ - Product Catalog
+ security:
+ - api_key: []
+ bearer_auth: []
+ description: |-
+ Removes each tag in `tags` from every product in `ids`.
+
+ **Required scope:** `write_products` (for API-key authentication).
+ parameters:
+ - name: x-spree-api-key
+ in: header
+ required: true
+ schema:
+ type: string
+ - name: Authorization
+ in: header
+ required: true
+ schema:
+ type: string
+ responses:
+ '200':
+ description: tags removed
+ content:
+ application/json:
+ example:
+ product_count: 1
+ tag_count: 1
+ requestBody:
+ content:
+ application/json:
+ schema:
+ type: object
+ required:
+ - ids
+ - tags
+ properties:
+ ids:
+ type: array
+ items:
+ type: string
+ tags:
+ type: array
+ items:
+ type: string
+ "/api/v3/admin/products/bulk_destroy":
+ delete:
+ summary: Bulk-delete products
+ tags:
+ - Product Catalog
+ security:
+ - api_key: []
+ bearer_auth: []
+ description: |-
+ Soft-deletes each product in `ids`. Returns the count actually destroyed.
+
+ **Required scope:** `write_products` (for API-key authentication).
+ parameters:
+ - name: x-spree-api-key
+ in: header
+ required: true
+ schema:
+ type: string
+ - name: Authorization
+ in: header
+ required: true
+ schema:
+ type: string
+ responses:
+ '200':
+ description: products deleted
+ content:
+ application/json:
+ example:
+ product_count: 1
+ schema:
+ type: object
+ properties:
+ product_count:
+ type: integer
+ requestBody:
+ content:
+ application/json:
+ schema:
+ type: object
+ required:
+ - ids
+ properties:
+ ids:
+ type: array
+ items:
+ type: string
"/api/v3/admin/promotions/{promotion_id}/promotion_actions":
parameters:
- name: promotion_id
@@ -9574,8 +9886,8 @@ paths:
example:
data:
- id: pact_UkLWZg9DAJ
- created_at: '2026-05-23T20:23:46.503Z'
- updated_at: '2026-05-23T20:23:46.503Z'
+ created_at: '2026-05-24T16:08:02.008Z'
+ updated_at: '2026-05-24T16:08:02.008Z'
type: free_shipping
promotion_id: promo_UkLWZg9DAJ
preferences: {}
@@ -9636,8 +9948,8 @@ paths:
application/json:
example:
id: pact_UkLWZg9DAJ
- created_at: '2026-05-23T20:23:47.074Z'
- updated_at: '2026-05-23T20:23:47.074Z'
+ created_at: '2026-05-24T16:08:02.573Z'
+ updated_at: '2026-05-24T16:08:02.573Z'
type: free_shipping
promotion_id: promo_UkLWZg9DAJ
preferences: {}
@@ -9747,8 +10059,8 @@ paths:
example:
data:
- id: prorule_UkLWZg9DAJ
- created_at: '2026-05-23T20:23:47.654Z'
- updated_at: '2026-05-23T20:23:47.654Z'
+ created_at: '2026-05-24T16:08:03.141Z'
+ updated_at: '2026-05-24T16:08:03.141Z'
type: currency
promotion_id: promo_UkLWZg9DAJ
preferences:
@@ -9815,8 +10127,8 @@ paths:
application/json:
example:
id: prorule_UkLWZg9DAJ
- created_at: '2026-05-23T20:23:48.233Z'
- updated_at: '2026-05-23T20:23:48.233Z'
+ created_at: '2026-05-24T16:08:03.697Z'
+ updated_at: '2026-05-24T16:08:03.697Z'
type: currency
promotion_id: promo_UkLWZg9DAJ
preferences:
@@ -9889,8 +10201,8 @@ paths:
application/json:
example:
id: prorule_UkLWZg9DAJ
- created_at: '2026-05-23T20:23:48.526Z'
- updated_at: '2026-05-23T20:23:48.805Z'
+ created_at: '2026-05-24T16:08:03.981Z'
+ updated_at: '2026-05-24T16:08:04.256Z'
type: currency
promotion_id: promo_UkLWZg9DAJ
preferences:
@@ -9980,7 +10292,7 @@ paths:
name: Summer Sale
description:
code: summer
- starts_at: '2026-05-23T20:23:49.092Z'
+ starts_at: '2026-05-24T16:08:04.540Z'
expires_at:
usage_limit:
match_policy: all
@@ -9991,8 +10303,8 @@ paths:
code_prefix:
promotion_category_id:
metadata: {}
- created_at: '2026-05-23T20:23:49.094Z'
- updated_at: '2026-05-23T20:23:49.095Z'
+ created_at: '2026-05-24T16:08:04.541Z'
+ updated_at: '2026-05-24T16:08:04.542Z'
store_ids:
- store_UkLWZg9DAJ
action_ids: []
@@ -10098,7 +10410,7 @@ paths:
name: Black Friday
description:
code: blackfriday-os
- starts_at: '2026-05-23T20:23:49.994Z'
+ starts_at: '2026-05-24T16:08:05.472Z'
expires_at:
usage_limit:
match_policy: all
@@ -10109,8 +10421,8 @@ paths:
code_prefix:
promotion_category_id:
metadata: {}
- created_at: '2026-05-23T20:23:49.995Z'
- updated_at: '2026-05-23T20:23:50.012Z'
+ created_at: '2026-05-24T16:08:05.473Z'
+ updated_at: '2026-05-24T16:08:05.494Z'
store_ids:
- store_UkLWZg9DAJ
action_ids:
@@ -10263,7 +10575,7 @@ paths:
name: Summer Sale
description:
code: summer
- starts_at: '2026-05-23T20:23:50.304Z'
+ starts_at: '2026-05-24T16:08:05.801Z'
expires_at:
usage_limit:
match_policy: all
@@ -10274,8 +10586,8 @@ paths:
code_prefix:
promotion_category_id:
metadata: {}
- created_at: '2026-05-23T20:23:50.305Z'
- updated_at: '2026-05-23T20:23:50.306Z'
+ created_at: '2026-05-24T16:08:05.802Z'
+ updated_at: '2026-05-24T16:08:05.803Z'
store_ids:
- store_UkLWZg9DAJ
action_ids: []
@@ -10371,7 +10683,7 @@ paths:
name: Summer Sale
description:
code: summer
- starts_at: '2026-05-23T20:23:51.202Z'
+ starts_at: '2026-05-24T16:08:06.703Z'
expires_at:
usage_limit:
match_policy: all
@@ -10382,8 +10694,8 @@ paths:
code_prefix:
promotion_category_id:
metadata: {}
- created_at: '2026-05-23T20:23:51.203Z'
- updated_at: '2026-05-23T20:23:51.487Z'
+ created_at: '2026-05-24T16:08:06.704Z'
+ updated_at: '2026-05-24T16:08:07.002Z'
store_ids:
- store_UkLWZg9DAJ
action_ids: []
@@ -10735,8 +11047,8 @@ paths:
data:
- id: role_UkLWZg9DAJ
name: admin
- created_at: '2026-05-23T20:23:52.432Z'
- updated_at: '2026-05-23T20:23:52.432Z'
+ created_at: '2026-05-24T16:08:07.983Z'
+ updated_at: '2026-05-24T16:08:07.983Z'
meta:
page: 1
limit: 25
@@ -10849,14 +11161,14 @@ paths:
example:
data:
- id: sloc_UkLWZg9DAJ
- state_abbr: STATE_ABBR_22
+ state_abbr: STATE_ABBR_30
name: Brooklyn warehouse
address1: 1600 Pennsylvania Ave NW
city: Washington
zipcode: '20500'
country_iso: US
country_name: United States of America
- state_text: STATE_ABBR_22
+ state_text: STATE_ABBR_30
admin_name:
address2:
state_name:
@@ -10871,8 +11183,8 @@ paths:
pickup_stock_policy: local
pickup_ready_in_minutes:
pickup_instructions:
- created_at: '2026-05-23T20:23:52.723Z'
- updated_at: '2026-05-23T20:23:52.723Z'
+ created_at: '2026-05-24T16:08:08.271Z'
+ updated_at: '2026-05-24T16:08:08.271Z'
meta:
page: 1
limit: 25
@@ -10983,8 +11295,8 @@ paths:
pickup_stock_policy: local
pickup_ready_in_minutes: 30
pickup_instructions:
- created_at: '2026-05-23T20:23:53.302Z'
- updated_at: '2026-05-23T20:23:53.302Z'
+ created_at: '2026-05-24T16:08:08.894Z'
+ updated_at: '2026-05-24T16:08:08.894Z'
schema:
"$ref": "#/components/schemas/StockLocation"
'422':
@@ -11136,14 +11448,14 @@ paths:
application/json:
example:
id: sloc_UkLWZg9DAJ
- state_abbr: STATE_ABBR_26
+ state_abbr: STATE_ABBR_34
name: Brooklyn warehouse
address1: 1600 Pennsylvania Ave NW
city: Washington
zipcode: '20500'
country_iso: US
country_name: United States of America
- state_text: STATE_ABBR_26
+ state_text: STATE_ABBR_34
admin_name:
address2:
state_name:
@@ -11158,8 +11470,8 @@ paths:
pickup_stock_policy: local
pickup_ready_in_minutes:
pickup_instructions:
- created_at: '2026-05-23T20:23:53.593Z'
- updated_at: '2026-05-23T20:23:53.593Z'
+ created_at: '2026-05-24T16:08:09.182Z'
+ updated_at: '2026-05-24T16:08:09.182Z'
schema:
"$ref": "#/components/schemas/StockLocation"
'404':
@@ -11222,14 +11534,14 @@ paths:
application/json:
example:
id: sloc_UkLWZg9DAJ
- state_abbr: STATE_ABBR_28
+ state_abbr: STATE_ABBR_36
name: Renamed warehouse
address1: 1600 Pennsylvania Ave NW
city: Washington
zipcode: '20500'
country_iso: US
country_name: United States of America
- state_text: STATE_ABBR_28
+ state_text: STATE_ABBR_36
admin_name:
address2:
state_name:
@@ -11244,8 +11556,8 @@ paths:
pickup_stock_policy: local
pickup_ready_in_minutes: 45
pickup_instructions:
- created_at: '2026-05-23T20:23:54.153Z'
- updated_at: '2026-05-23T20:23:54.426Z'
+ created_at: '2026-05-24T16:08:09.740Z'
+ updated_at: '2026-05-24T16:08:10.079Z'
schema:
"$ref": "#/components/schemas/StockLocation"
'422':
@@ -11448,8 +11760,8 @@ paths:
data:
- id: sccat_UkLWZg9DAJ
name: Goodwill
- created_at: '2026-05-23T20:23:55.001Z'
- updated_at: '2026-05-23T20:23:55.001Z'
+ created_at: '2026-05-24T16:08:10.647Z'
+ updated_at: '2026-05-24T16:08:10.647Z'
non_expiring: false
meta:
page: 1
@@ -11540,8 +11852,8 @@ paths:
example:
id: sccat_UkLWZg9DAJ
name: Goodwill
- created_at: '2026-05-23T20:23:55.293Z'
- updated_at: '2026-05-23T20:23:55.293Z'
+ created_at: '2026-05-24T16:08:10.941Z'
+ updated_at: '2026-05-24T16:08:10.941Z'
non_expiring: false
schema:
"$ref": "#/components/schemas/StoreCreditCategory"
@@ -11606,8 +11918,8 @@ paths:
preferred_timezone: UTC
preferred_weight_unit: lb
preferred_unit_system: imperial
- created_at: '2026-05-23T20:22:46.982Z'
- updated_at: '2026-05-23T20:23:55.941Z'
+ created_at: '2026-05-24T16:06:58.976Z'
+ updated_at: '2026-05-24T16:08:11.519Z'
url: http://www.example.com:3000
supported_currencies:
- USD
@@ -11678,8 +11990,8 @@ paths:
preferred_timezone: UTC
preferred_weight_unit: lb
preferred_unit_system: imperial
- created_at: '2026-05-23T20:22:46.982Z'
- updated_at: '2026-05-23T20:23:56.538Z'
+ created_at: '2026-05-24T16:06:58.976Z'
+ updated_at: '2026-05-24T16:08:12.130Z'
url: http://www.example.com:3000
supported_currencies:
- USD
@@ -11867,7 +12179,7 @@ paths:
data:
- id: variant_UkLWZg9DAJ
product_id: prod_UkLWZg9DAJ
- sku: SKU-56
+ sku: SKU-65
options_text: ''
track_inventory: true
media_count: 0
@@ -11899,16 +12211,16 @@ paths:
weight_unit: lb
dimensions_unit:
deleted_at:
- created_at: '2026-05-23T20:23:57.954Z'
- updated_at: '2026-05-23T20:23:57.967Z'
+ created_at: '2026-05-24T16:08:13.648Z'
+ updated_at: '2026-05-24T16:08:13.674Z'
tax_category_id: taxcat_UkLWZg9DAJ
available_stock: 0
reserved_quantity: 0
total_on_hand: 0
- product_name: Product 505046
+ product_name: Product 593078
- id: variant_gbHJdmfrXB
product_id: prod_UkLWZg9DAJ
- sku: SKU-57
+ sku: SKU-66
options_text: 'Size: S'
track_inventory: true
media_count: 0
@@ -11916,10 +12228,10 @@ paths:
purchasable: true
in_stock: false
backorderable: true
- weight: 189.65
- height: 156.3
- width: 34.0
- depth: 24.46
+ weight: 188.11
+ height: 73.5
+ width: 155.82
+ depth: 70.36
price:
id: price_gbHJdmfrXB
amount: '19.99'
@@ -11942,8 +12254,8 @@ paths:
option_type_label: Size
image_url:
metadata: {}
- created_at: '2026-05-23T20:23:57.976Z'
- updated_at: '2026-05-23T20:23:57.976Z'
+ created_at: '2026-05-24T16:08:13.700Z'
+ updated_at: '2026-05-24T16:08:13.700Z'
metadata: {}
position: 2
cost_price: '17.0'
@@ -11952,13 +12264,13 @@ paths:
weight_unit: lb
dimensions_unit:
deleted_at:
- created_at: '2026-05-23T20:23:57.973Z'
- updated_at: '2026-05-23T20:23:57.986Z'
+ created_at: '2026-05-24T16:08:13.694Z'
+ updated_at: '2026-05-24T16:08:13.731Z'
tax_category_id: taxcat_UkLWZg9DAJ
available_stock: 0
reserved_quantity: 0
total_on_hand: 0
- product_name: Product 505046
+ product_name: Product 593078
meta:
page: 1
limit: 25
@@ -12069,8 +12381,8 @@ paths:
option_type_label: Size
image_url:
metadata: {}
- created_at: '2026-05-23T20:23:58.625Z'
- updated_at: '2026-05-23T20:23:58.625Z'
+ created_at: '2026-05-24T16:08:14.430Z'
+ updated_at: '2026-05-24T16:08:14.430Z'
metadata: {}
position: 3
cost_price:
@@ -12079,13 +12391,13 @@ paths:
weight_unit: lb
dimensions_unit:
deleted_at:
- created_at: '2026-05-23T20:23:58.629Z'
- updated_at: '2026-05-23T20:23:58.630Z'
+ created_at: '2026-05-24T16:08:14.433Z'
+ updated_at: '2026-05-24T16:08:14.435Z'
tax_category_id: taxcat_UkLWZg9DAJ
available_stock: 0
reserved_quantity: 0
total_on_hand: 0
- product_name: Product 518713
+ product_name: Product 609367
'422':
description: validation error
content:
@@ -12264,7 +12576,7 @@ paths:
example:
id: variant_gbHJdmfrXB
product_id: prod_UkLWZg9DAJ
- sku: SKU-63
+ sku: SKU-72
options_text: 'Size: S'
track_inventory: true
media_count: 0
@@ -12272,10 +12584,10 @@ paths:
purchasable: true
in_stock: false
backorderable: true
- weight: 133.16
- height: 16.16
- width: 165.3
- depth: 42.4
+ weight: 166.11
+ height: 57.26
+ width: 145.78
+ depth: 147.83
price:
id: price_gbHJdmfrXB
amount: '19.99'
@@ -12298,8 +12610,8 @@ paths:
option_type_label: Size
image_url:
metadata: {}
- created_at: '2026-05-23T20:23:59.027Z'
- updated_at: '2026-05-23T20:23:59.027Z'
+ created_at: '2026-05-24T16:08:14.821Z'
+ updated_at: '2026-05-24T16:08:14.821Z'
metadata: {}
position: 2
cost_price: '17.0'
@@ -12308,13 +12620,13 @@ paths:
weight_unit: lb
dimensions_unit:
deleted_at:
- created_at: '2026-05-23T20:23:59.025Z'
- updated_at: '2026-05-23T20:23:59.040Z'
+ created_at: '2026-05-24T16:08:14.819Z'
+ updated_at: '2026-05-24T16:08:14.830Z'
tax_category_id: taxcat_UkLWZg9DAJ
available_stock: 0
reserved_quantity: 0
total_on_hand: 0
- product_name: Product 537170
+ product_name: Product 628998
'404':
description: variant not found
content:
@@ -12393,10 +12705,10 @@ paths:
purchasable: true
in_stock: false
backorderable: true
- weight: 119.15
- height: 136.54
- width: 18.61
- depth: 38.93
+ weight: 36.36
+ height: 15.7
+ width: 106.81
+ depth: 170.69
price:
id: price_gbHJdmfrXB
amount: '19.99'
@@ -12419,8 +12731,8 @@ paths:
option_type_label: Size
image_url:
metadata: {}
- created_at: '2026-05-23T20:23:59.731Z'
- updated_at: '2026-05-23T20:23:59.731Z'
+ created_at: '2026-05-24T16:08:15.500Z'
+ updated_at: '2026-05-24T16:08:15.500Z'
metadata: {}
position: 2
cost_price: '17.0'
@@ -12429,13 +12741,13 @@ paths:
weight_unit: lb
dimensions_unit:
deleted_at:
- created_at: '2026-05-23T20:23:59.729Z'
- updated_at: '2026-05-23T20:24:00.026Z'
+ created_at: '2026-05-24T16:08:15.498Z'
+ updated_at: '2026-05-24T16:08:15.789Z'
tax_category_id: taxcat_UkLWZg9DAJ
available_stock: 0
reserved_quantity: 0
total_on_hand: 0
- product_name: Product 556459
+ product_name: Product 6429
requestBody:
content:
application/json:
diff --git a/packages/admin-sdk/src/admin-client.ts b/packages/admin-sdk/src/admin-client.ts
index 257bf9b16f..bb52a4eae5 100644
--- a/packages/admin-sdk/src/admin-client.ts
+++ b/packages/admin-sdk/src/admin-client.ts
@@ -435,6 +435,58 @@ export class AdminClient {
delete: (id: string, options?: RequestOptions): Promise<void> =>
this.request<void>('DELETE', `/products/${id}`, options),
+ /**
+ * Duplicate a product. Returns the freshly-created clone (status `draft`,
+ * name prefixed "COPY OF"). Media is duplicated by default server-side.
+ */
+ clone: (id: string, options?: RequestOptions): Promise<Product> =>
+ this.request<Product>('POST', `/products/${id}/clone`, options),
+
+ /**
+ * Bulk-set `status` on a list of products. The server validates `status`
+ * against the product status enum and reindexes affected products.
+ */
+ bulkStatusUpdate: (
+ params: { ids: string[]; status: 'draft' | 'active' | 'archived' },
+ options?: RequestOptions,
+ ): Promise<{ product_count: number; status: string }> =>
+ this.request('POST', '/products/bulk_status_update', { ...options, body: params }),
+
+ /** Attach every product in `ids` to every category in `category_ids`. */
+ bulkAddToCategories: (
+ params: { ids: string[]; category_ids: string[] },
+ options?: RequestOptions,
+ ): Promise<{ product_count: number; category_count: number }> =>
+ this.request('POST', '/products/bulk_add_to_categories', { ...options, body: params }),
+
+ /** Detach every product in `ids` from every category in `category_ids`. */
+ bulkRemoveFromCategories: (
+ params: { ids: string[]; category_ids: string[] },
+ options?: RequestOptions,
+ ): Promise<{ product_count: number; category_count: number }> =>
+ this.request('POST', '/products/bulk_remove_from_categories', { ...options, body: params }),
+
+ /** Add each tag name to every product. Tags are upserted by name. */
+ bulkAddTags: (
+ params: { ids: string[]; tags: string[] },
+ options?: RequestOptions,
+ ): Promise<{ product_count: number; tag_count: number }> =>
+ this.request('POST', '/products/bulk_add_tags', { ...options, body: params }),
+
+ /** Remove each tag name from every product. No-op for non-tagged. */
+ bulkRemoveTags: (
+ params: { ids: string[]; tags: string[] },
+ options?: RequestOptions,
+ ): Promise<{ product_count: number; tag_count: number }> =>
+ this.request('POST', '/products/bulk_remove_tags', { ...options, body: params }),
+
+ /** Soft-delete a list of products. */
+ bulkDestroy: (
+ params: { ids: string[] },
+ options?: RequestOptions,
+ ): Promise<{ product_count: number }> =>
+ this.request('DELETE', '/products/bulk_destroy', { ...options, body: params }),
+
media: {
list: (
productId: string,
@@ -1318,6 +1370,20 @@ export class AdminClient {
): Promise<{ customer_count: number; customer_group_count: number }> =>
this.request('POST', '/customers/bulk_remove_from_groups', { ...options, body: params }),
+ /** Add each tag name to every customer. Tags are upserted by name. */
+ bulkAddTags: (
+ params: { ids: string[]; tags: string[] },
+ options?: RequestOptions,
+ ): Promise<{ customer_count: number; tag_count: number }> =>
+ this.request('POST', '/customers/bulk_add_tags', { ...options, body: params }),
+
+ /** Remove each tag name from every customer. No-op for non-tagged. */
+ bulkRemoveTags: (
+ params: { ids: string[]; tags: string[] },
+ options?: RequestOptions,
+ ): Promise<{ customer_count: number; tag_count: number }> =>
+ this.request('POST', '/customers/bulk_remove_tags', { ...options, body: params }),
+
addresses: {
list: (
customerId: string,
diff --git a/packages/admin/e2e/global-setup.ts b/packages/admin/e2e/global-setup.ts
index eac13d4006..aff9ebbea9 100644
--- a/packages/admin/e2e/global-setup.ts
+++ b/packages/admin/e2e/global-setup.ts
@@ -2,6 +2,16 @@ import { type ChildProcess, spawn, spawnSync } from 'node:child_process'
import { unlinkSync, writeFileSync } from 'node:fs'
import { resolve } from 'node:path'
import {
+ FIXTURE_BULK_CATEGORY,
+ FIXTURE_BULK_PRODUCT_A,
+ FIXTURE_BULK_PRODUCT_B,
+ FIXTURE_BULK_PRODUCT_C,
+ FIXTURE_BULK_PRODUCT_D,
+ FIXTURE_BULK_PRODUCT_E,
+ FIXTURE_BULK_PRODUCT_F,
+ FIXTURE_BULK_PRODUCT_G,
+ FIXTURE_BULK_PRODUCT_H,
+ FIXTURE_BULK_PRODUCT_I,
FIXTURE_PROMO_CUSTOMER_EMAIL,
FIXTURE_PROMO_CUSTOMER_FIRST_NAME,
FIXTURE_PROMO_CUSTOMER_FULL_NAME,
@@ -40,6 +50,23 @@ const BOOTSTRAP_RUBY = [
`shipping_category = Spree::ShippingCategory.first || Spree::ShippingCategory.create!(name: 'Default')`,
`product = Spree::Product.where(name: '${FIXTURE_PROMO_PRODUCT}').first_or_create!(price: 19.99, shipping_category: shipping_category, stores: [s], status: 'active')`,
`product.taxons << category unless product.taxons.include?(category)`,
+ // Disjoint product fixtures for products-bulk.spec.ts. Each test owns its
+ // own pair (A/B → status, C/D → categories, E/F → tags, G/H → delete,
+ // I → row-action clone/delete) so the serial suite can mutate them in any
+ // order without poisoning siblings. All start `active` so the status spec
+ // sees a clean transition.
+ `Spree::Product.where(name: '${FIXTURE_BULK_PRODUCT_A}').first_or_create!(price: 9.99, shipping_category: shipping_category, stores: [s], status: 'active').update!(status: 'active')`,
+ `Spree::Product.where(name: '${FIXTURE_BULK_PRODUCT_B}').first_or_create!(price: 9.99, shipping_category: shipping_category, stores: [s], status: 'active').update!(status: 'active')`,
+ `Spree::Product.where(name: '${FIXTURE_BULK_PRODUCT_C}').first_or_create!(price: 9.99, shipping_category: shipping_category, stores: [s], status: 'active').update!(status: 'active')`,
+ `Spree::Product.where(name: '${FIXTURE_BULK_PRODUCT_D}').first_or_create!(price: 9.99, shipping_category: shipping_category, stores: [s], status: 'active').update!(status: 'active')`,
+ `Spree::Product.where(name: '${FIXTURE_BULK_PRODUCT_E}').first_or_create!(price: 9.99, shipping_category: shipping_category, stores: [s], status: 'active').update!(status: 'active')`,
+ `Spree::Product.where(name: '${FIXTURE_BULK_PRODUCT_F}').first_or_create!(price: 9.99, shipping_category: shipping_category, stores: [s], status: 'active').update!(status: 'active')`,
+ `Spree::Product.where(name: '${FIXTURE_BULK_PRODUCT_G}').first_or_create!(price: 9.99, shipping_category: shipping_category, stores: [s], status: 'active').update!(status: 'active')`,
+ `Spree::Product.where(name: '${FIXTURE_BULK_PRODUCT_H}').first_or_create!(price: 9.99, shipping_category: shipping_category, stores: [s], status: 'active').update!(status: 'active')`,
+ `Spree::Product.where(name: '${FIXTURE_BULK_PRODUCT_I}').first_or_create!(price: 9.99, shipping_category: shipping_category, stores: [s], status: 'active').update!(status: 'active')`,
+ // Category used by the bulk-add-to-categories test. Sits in the same
+ // `Categories` taxonomy as the promo taxon above.
+ `taxonomy.taxons.where(name: '${FIXTURE_BULK_CATEGORY}').first_or_create!(parent: taxonomy.root)`,
`Spree.user_class.where(email: '${FIXTURE_PROMO_CUSTOMER_EMAIL}').first_or_create! { |u| u.password = 'customer123'; u.password_confirmation = 'customer123'; u.first_name = '${FIXTURE_PROMO_CUSTOMER_FIRST_NAME}'; u.last_name = '${FIXTURE_PROMO_CUSTOMER_LAST_NAME}' }`,
`s.customer_groups.where(name: '${FIXTURE_PROMO_CUSTOMER_GROUP}').first_or_create!`,
'port = ENV.fetch("PORT", 3010)',
diff --git a/packages/admin/e2e/helpers.ts b/packages/admin/e2e/helpers.ts
index cf8d4ef4ff..5d10ac50ac 100644
--- a/packages/admin/e2e/helpers.ts
+++ b/packages/admin/e2e/helpers.ts
@@ -9,6 +9,22 @@ import { CREDENTIALS_FILE } from './paths'
*/
export const FIXTURE_PROMO_TAXON = 'E2E Promo Category'
export const FIXTURE_PROMO_PRODUCT = 'E2E Promo Product'
+// Active products used by products-bulk.spec.ts. Each test owns a disjoint
+// pair so the serial suite doesn't cross-contaminate (status mutations on
+// A/B don't shift the rows that the category/tag tests target). Kept here
+// so the seed step and the spec stay in sync.
+export const FIXTURE_BULK_PRODUCT_A = 'E2E Bulk Product A'
+export const FIXTURE_BULK_PRODUCT_B = 'E2E Bulk Product B'
+export const FIXTURE_BULK_PRODUCT_C = 'E2E Bulk Product C'
+export const FIXTURE_BULK_PRODUCT_D = 'E2E Bulk Product D'
+export const FIXTURE_BULK_PRODUCT_E = 'E2E Bulk Product E'
+export const FIXTURE_BULK_PRODUCT_F = 'E2E Bulk Product F'
+export const FIXTURE_BULK_PRODUCT_G = 'E2E Bulk Product G'
+export const FIXTURE_BULK_PRODUCT_H = 'E2E Bulk Product H'
+export const FIXTURE_BULK_PRODUCT_I = 'E2E Bulk Product I'
+// Dedicated category seeded for the bulk-add-to-categories test; lives under
+// the `Categories` taxonomy alongside `FIXTURE_PROMO_TAXON`.
+export const FIXTURE_BULK_CATEGORY = 'E2E Bulk Category'
export const FIXTURE_PROMO_CUSTOMER_EMAIL = '[email protected]'
export const FIXTURE_PROMO_CUSTOMER_FIRST_NAME = 'Promo'
export const FIXTURE_PROMO_CUSTOMER_FULL_NAME = 'Promo Customer'
diff --git a/packages/admin/e2e/products-bulk.spec.ts b/packages/admin/e2e/products-bulk.spec.ts
new file mode 100644
index 0000000000..08f324d678
--- /dev/null
+++ b/packages/admin/e2e/products-bulk.spec.ts
@@ -0,0 +1,214 @@
+import { expect, type Page, test } from '@playwright/test'
+import {
+ FIXTURE_BULK_CATEGORY,
+ FIXTURE_BULK_PRODUCT_A,
+ FIXTURE_BULK_PRODUCT_B,
+ FIXTURE_BULK_PRODUCT_C,
+ FIXTURE_BULK_PRODUCT_D,
+ FIXTURE_BULK_PRODUCT_E,
+ FIXTURE_BULK_PRODUCT_F,
+ FIXTURE_BULK_PRODUCT_G,
+ FIXTURE_BULK_PRODUCT_H,
+ FIXTURE_BULK_PRODUCT_I,
+ gotoIndex,
+ login,
+} from './helpers'
+
+const PRODUCTS_PATH = (storeId: string) => `/${storeId}/products`
+const CTA = /add product/i
+
+/**
+ * Tick the row-level checkbox of the row whose name cell contains
+ * `productName`. The leading checkbox cell carries `aria-label="Select row"`
+ * (set by `<ResourceTable>` when `bulkActions` is supplied).
+ */
+async function selectRow(page: Page, productName: string) {
+ await page
+ .locator('tr')
+ .filter({ hasText: productName })
+ .getByRole('checkbox', { name: /select row/i })
+ .check()
+}
+
+/**
+ * Open the row-action kebab menu for the row whose name cell contains
+ * `productName`. The menu trigger carries the universal `admin.row_actions.menu_label`
+ * aria-label ("Open actions").
+ */
+async function openRowMenu(page: Page, productName: string) {
+ await page
+ .locator('tr')
+ .filter({ hasText: productName })
+ .getByRole('button', { name: /open actions/i })
+ .click()
+}
+
+test.describe('products bulk operations', () => {
+ test('archives selected products via Set status…', async ({ page }) => {
+ const creds = await login(page)
+ await gotoIndex(page, PRODUCTS_PATH(creds.store_id), CTA)
+
+ // Both seeded products start as Active. Sanity-check before mutating.
+ await expect(page.getByRole('link', { name: FIXTURE_BULK_PRODUCT_A })).toBeVisible({
+ timeout: 15_000,
+ })
+ await expect(page.getByRole('link', { name: FIXTURE_BULK_PRODUCT_B })).toBeVisible()
+
+ await selectRow(page, FIXTURE_BULK_PRODUCT_A)
+ await selectRow(page, FIXTURE_BULK_PRODUCT_B)
+ await expect(page.getByText(/^2 selected$/)).toBeVisible()
+
+ await page.getByRole('button', { name: /set status/i }).click()
+ await expect(page.getByRole('heading', { name: /set product status/i })).toBeVisible()
+
+ await page.getByRole('combobox').click()
+ await page.getByRole('option', { name: /^archived$/i }).click()
+ await page
+ .getByRole('dialog')
+ .getByRole('button', { name: /^apply$/i })
+ .click()
+
+ // The bulk-action bar surfaces a counted success toast, and the rows'
+ // `<StatusBadge>` swaps to Archived once the table refetches.
+ await expect(page.getByText(/updated status on 2 products/i)).toBeVisible({
+ timeout: 15_000,
+ })
+ const rowA = page.locator('tr').filter({ hasText: FIXTURE_BULK_PRODUCT_A })
+ const rowB = page.locator('tr').filter({ hasText: FIXTURE_BULK_PRODUCT_B })
+ await expect(rowA.getByText(/archived/i)).toBeVisible()
+ await expect(rowB.getByText(/archived/i)).toBeVisible()
+ })
+
+ test('attaches selected products to a category via Add to categories…', async ({ page }) => {
+ const creds = await login(page)
+ await gotoIndex(page, PRODUCTS_PATH(creds.store_id), CTA)
+
+ await selectRow(page, FIXTURE_BULK_PRODUCT_C)
+ await selectRow(page, FIXTURE_BULK_PRODUCT_D)
+ await expect(page.getByText(/^2 selected$/)).toBeVisible()
+
+ await page.getByRole('button', { name: /add to categories/i }).click()
+ await expect(page.getByRole('heading', { name: /^add to categories$/i })).toBeVisible()
+
+ // The category combobox is a chips-with-search picker. Type the seed
+ // category name and pick the matching option.
+ await page
+ .getByRole('dialog')
+ .getByPlaceholder(/search categories/i)
+ .fill(FIXTURE_BULK_CATEGORY)
+ await page
+ .getByRole('option', { name: new RegExp(FIXTURE_BULK_CATEGORY, 'i') })
+ .first()
+ .click()
+ await page.getByRole('dialog').getByRole('button', { name: /^add$/i }).click()
+
+ await expect(page.getByText(/added 2 products to categories/i)).toBeVisible({
+ timeout: 15_000,
+ })
+
+ // Open product C's edit page and confirm the category chip is rendered.
+ await page.getByRole('link', { name: FIXTURE_BULK_PRODUCT_C }).click()
+ await expect(page.getByRole('heading', { name: FIXTURE_BULK_PRODUCT_C })).toBeVisible({
+ timeout: 15_000,
+ })
+ await expect(page.getByText(FIXTURE_BULK_CATEGORY)).toBeVisible()
+ })
+
+ test('tags selected products via Add tags…', async ({ page }) => {
+ const creds = await login(page)
+ await gotoIndex(page, PRODUCTS_PATH(creds.store_id), CTA)
+
+ // Unique tag name per run so re-running the suite locally doesn't trip on
+ // the "already tagged" path.
+ const tagName = `e2e-bulk-tag-${Date.now()}`
+
+ await selectRow(page, FIXTURE_BULK_PRODUCT_E)
+ await selectRow(page, FIXTURE_BULK_PRODUCT_F)
+ await expect(page.getByText(/^2 selected$/)).toBeVisible()
+
+ await page.getByRole('button', { name: /^add tags…$/i }).click()
+ await expect(page.getByRole('heading', { name: /^add tags$/i })).toBeVisible()
+
+ // TagCombobox: type the new tag, press Enter to confirm it as a chip.
+ const tagInput = page.getByRole('dialog').getByPlaceholder(/type to add tags/i)
+ await tagInput.fill(tagName)
+ await tagInput.press('Enter')
+ await expect(page.getByRole('dialog').getByText(tagName)).toBeVisible()
+
+ await page.getByRole('dialog').getByRole('button', { name: /^add$/i }).click()
+
+ await expect(page.getByText(/added tags to 2 products/i)).toBeVisible({ timeout: 15_000 })
+ })
+
+ test('soft-deletes selected products via the bulk Delete action', async ({ page }) => {
+ const creds = await login(page)
+ await gotoIndex(page, PRODUCTS_PATH(creds.store_id), CTA)
+
+ await expect(page.getByRole('link', { name: FIXTURE_BULK_PRODUCT_G })).toBeVisible({
+ timeout: 15_000,
+ })
+ await selectRow(page, FIXTURE_BULK_PRODUCT_G)
+ await selectRow(page, FIXTURE_BULK_PRODUCT_H)
+ await expect(page.getByText(/^2 selected$/)).toBeVisible()
+
+ // The Delete bulk action confirms via the shared confirm dialog (NOT the
+ // form-based BulkDialog) — the confirm dialog uses role="alertdialog" or
+ // role="dialog" with the heading "Delete {n} products?".
+ await page.getByRole('button', { name: /^delete$/i }).click()
+ await expect(page.getByRole('heading', { name: /delete 2 products\?/i })).toBeVisible()
+ await page
+ .getByRole('dialog')
+ .getByRole('button', { name: /^delete$/i })
+ .click()
+
+ await expect(page.getByText(/deleted 2 products/i)).toBeVisible({ timeout: 15_000 })
+
+ // Once the table refetches, the rows are gone (soft-deleted = filtered
+ // out of the default list scope).
+ await expect(page.getByRole('link', { name: FIXTURE_BULK_PRODUCT_G })).toHaveCount(0, {
+ timeout: 15_000,
+ })
+ await expect(page.getByRole('link', { name: FIXTURE_BULK_PRODUCT_H })).toHaveCount(0)
+ })
+
+ test('duplicates a product via the row-action menu and lands on its edit page', async ({
+ page,
+ }) => {
+ const creds = await login(page)
+ await gotoIndex(page, PRODUCTS_PATH(creds.store_id), CTA)
+
+ await openRowMenu(page, FIXTURE_BULK_PRODUCT_I)
+ await page.getByRole('menuitem', { name: /duplicate/i }).click()
+
+ // Server prefixes clones with "COPY OF " — the page title becomes the new
+ // name once the navigation completes.
+ await expect(
+ page.getByRole('heading', { name: new RegExp(`COPY OF ${FIXTURE_BULK_PRODUCT_I}`, 'i') }),
+ ).toBeVisible({ timeout: 15_000 })
+ await expect(page.getByText(/product duplicated/i)).toBeVisible()
+ })
+
+ test('deletes a product via the row-action menu after confirming', async ({ page }) => {
+ const creds = await login(page)
+ await gotoIndex(page, PRODUCTS_PATH(creds.store_id), CTA)
+
+ // The previous test duplicated product I, so a "COPY OF E2E Bulk Product I"
+ // row exists. Delete it via the row-action menu to exercise the row-level
+ // confirm + delete path without depleting other fixtures.
+ const cloneName = `COPY OF ${FIXTURE_BULK_PRODUCT_I}`
+ await expect(page.getByRole('link', { name: cloneName })).toBeVisible({ timeout: 15_000 })
+ await openRowMenu(page, cloneName)
+ await page.getByRole('menuitem', { name: /^delete$/i }).click()
+
+ // ConfirmProvider renders a generic confirm dialog with the
+ // `admin.products.delete_label` title and the standard confirm copy.
+ await expect(page.getByRole('heading', { name: /delete product/i })).toBeVisible()
+ await page
+ .getByRole('dialog')
+ .getByRole('button', { name: /^delete$/i })
+ .click()
+
+ await expect(page.getByText(/product deleted/i)).toBeVisible({ timeout: 15_000 })
+ await expect(page.getByRole('link', { name: cloneName })).toHaveCount(0, { timeout: 15_000 })
+ })
+})
diff --git a/packages/admin/src/components/spree/bulk-dialog.tsx b/packages/admin/src/components/spree/bulk-dialog.tsx
new file mode 100644
index 0000000000..06d5d9d853
--- /dev/null
+++ b/packages/admin/src/components/spree/bulk-dialog.tsx
@@ -0,0 +1,63 @@
+import type { ReactNode } from 'react'
+import { useTranslation } from 'react-i18next'
+import { Button } from '@/components/ui/button'
+import {
+ Dialog,
+ DialogBody,
+ DialogContent,
+ DialogDescription,
+ DialogFooter,
+ DialogHeader,
+ DialogTitle,
+} from '@/components/ui/dialog'
+import { FieldGroup } from '@/components/ui/field'
+
+interface BulkDialogProps {
+ title: string
+ description?: string
+ submitLabel: string
+ submitDisabled?: boolean
+ onCancel: () => void
+ onSubmit: () => void
+ children: ReactNode
+}
+
+/**
+ * Modal dialog used by `BulkActionBar` form actions — title/description header,
+ * scrollable body wrapping a single `<FieldGroup>`, footer with Cancel/Submit.
+ * The standard shape for "pick a value and apply to N selected rows" flows;
+ * use a Sheet only when the form needs more space than a centered modal.
+ */
+export function BulkDialog({
+ title,
+ description,
+ submitLabel,
+ submitDisabled,
+ onCancel,
+ onSubmit,
+ children,
+}: BulkDialogProps) {
+ const { t } = useTranslation()
+
+ return (
+ <Dialog open onOpenChange={(o) => !o && onCancel()}>
+ <DialogContent>
+ <DialogHeader>
+ <DialogTitle>{title}</DialogTitle>
+ {description && <DialogDescription>{description}</DialogDescription>}
+ </DialogHeader>
+ <DialogBody>
+ <FieldGroup>{children}</FieldGroup>
+ </DialogBody>
+ <DialogFooter>
+ <Button type="button" variant="outline" size="sm" onClick={onCancel}>
+ {t('admin.actions.cancel')}
+ </Button>
+ <Button type="button" size="sm" disabled={submitDisabled} onClick={onSubmit}>
+ {submitLabel}
+ </Button>
+ </DialogFooter>
+ </DialogContent>
+ </Dialog>
+ )
+}
diff --git a/packages/admin/src/components/spree/resource-table.tsx b/packages/admin/src/components/spree/resource-table.tsx
index b8c861a191..7166ed3f48 100644
--- a/packages/admin/src/components/spree/resource-table.tsx
+++ b/packages/admin/src/components/spree/resource-table.tsx
@@ -152,6 +152,12 @@ interface ResourceTableProps<T> {
*/
// eslint-disable-next-line @typescript-eslint/no-explicit-any
bulkActions?: BulkAction<any>[]
+ /**
+ * Per-row action menu. When set, a trailing cell renders whatever the
+ * function returns (typically a `<DropdownMenu>` with Edit/Clone/Delete).
+ * Skipped under reorder mode because the trailing cell is already busy.
+ */
+ rowActions?: (row: T) => ReactNode
}
export interface ReorderConfig<T> {
@@ -174,6 +180,7 @@ export function ResourceTable<T extends Record<string, any>>({
actions,
reorder,
bulkActions,
+ rowActions,
}: ResourceTableProps<T>) {
const table = getTable<T>(tableKey)
const { t } = useTranslation()
@@ -182,6 +189,7 @@ export function ResourceTable<T extends Record<string, any>>({
const queryClient = useQueryClient()
const selectionEnabled = !!bulkActions?.length && !reorder
+ const rowActionsEnabled = !!rowActions && !reorder
const [selectedIds, setSelectedIds] = useState<Set<string>>(() => new Set())
const {
@@ -463,15 +471,24 @@ export function ResourceTable<T extends Record<string, any>>({
{col.label}
</TableHead>
))}
+ {rowActionsEnabled && <TableHead className="w-12" />}
</tr>
</TableHeader>
<TableBody>
{isLoading ? (
- <TableEmpty colSpan={visibleColumns.length + (selectionEnabled ? 1 : 0)}>
+ <TableEmpty
+ colSpan={
+ visibleColumns.length + (selectionEnabled ? 1 : 0) + (rowActionsEnabled ? 1 : 0)
+ }
+ >
Loading...
</TableEmpty>
) : rows.length === 0 ? (
- <TableEmpty colSpan={visibleColumns.length + (selectionEnabled ? 1 : 0)}>
+ <TableEmpty
+ colSpan={
+ visibleColumns.length + (selectionEnabled ? 1 : 0) + (rowActionsEnabled ? 1 : 0)
+ }
+ >
<Empty className="border-0 p-0">
<EmptyHeader>
{table.emptyIcon && <EmptyMedia variant="icon">{table.emptyIcon}</EmptyMedia>}
@@ -505,6 +522,9 @@ export function ResourceTable<T extends Record<string, any>>({
{col.render ? col.render(row) : String((row as any)[col.key] ?? '—')}
</TableCell>
))}
+ {rowActionsEnabled && (
+ <TableCell className="w-12 text-right">{rowActions?.(row)}</TableCell>
+ )}
</TableRow>
)
})
diff --git a/packages/admin/src/components/spree/table-toolbar.tsx b/packages/admin/src/components/spree/table-toolbar.tsx
index 1fcb79f349..ad857627f8 100644
--- a/packages/admin/src/components/spree/table-toolbar.tsx
+++ b/packages/admin/src/components/spree/table-toolbar.tsx
@@ -11,6 +11,7 @@ import {
import { useCallback, useMemo, useRef, useState } from 'react'
import { ResourceMultiAutocomplete } from '@/components/spree/resource-multi-autocomplete'
import { StoreDatePicker } from '@/components/spree/store-date-picker'
+import { TagCombobox } from '@/components/spree/tag-combobox'
import { Badge } from '@/components/ui/badge'
import { Button } from '@/components/ui/button'
import { CardTitle } from '@/components/ui/card'
@@ -103,6 +104,12 @@ const operatorsByType: Record<string, { value: string; label: string }[]> = {
{ value: 'in', label: 'is any of' },
{ value: 'not_in', label: 'is none of' },
],
+ // Tag names round-trip as CSV; `filtersToRansack` decodes to the
+ // `tags_name_in` / `tags_name_not_in` predicate when emitting Ransack.
+ tags: [
+ { value: 'in', label: 'is any of' },
+ { value: 'not_in', label: 'is none of' },
+ ],
// Same shape as `enum` — the value picker just sources its option list
// from the active store's `supported_currencies`.
currency: [
@@ -287,6 +294,8 @@ function FilterChip({
{showValue &&
(col?.filterType === 'resource' && col.filterResource ? (
<ResourceFilterValue value={filter.value} config={col.filterResource} />
+ ) : col?.filterType === 'tags' ? (
+ <span className="font-medium">{parseFilterIds(filter.value).join(', ')}</span>
) : (
<span className="font-medium">{filter.value}</span>
))}
@@ -613,7 +622,7 @@ function FilterPanel({
const ops = getOperators(type)
return (
- <div key={filter.id} className="flex items-center gap-1.5">
+ <div key={filter.id} className="flex min-w-0 items-center gap-1.5">
<Select
items={fieldItems}
value={filter.field}
@@ -670,6 +679,14 @@ function FilterPanel({
emptyText={col.filterResource.emptyText}
/>
</div>
+ ) : col?.filterType === 'tags' && col.taggableType ? (
+ <div className="flex-1 min-w-0">
+ <TagCombobox
+ taggableType={col.taggableType}
+ value={parseFilterIds(filter.value)}
+ onChange={(names) => updateFilter(filter.id, { value: names.join(',') })}
+ />
+ </div>
) : col?.filterType === 'enum' && col.filterOptions ? (
<Select
items={col.filterOptions}
diff --git a/packages/admin/src/components/spree/tag-list.tsx b/packages/admin/src/components/spree/tag-list.tsx
new file mode 100644
index 0000000000..e32870b746
--- /dev/null
+++ b/packages/admin/src/components/spree/tag-list.tsx
@@ -0,0 +1,26 @@
+import { Badge } from '@/components/ui/badge'
+
+interface TagListProps {
+ tags: string[] | null | undefined
+ /** Rendered when there are no tags. Defaults to em-dash to match other empty cells. */
+ empty?: string
+}
+
+/**
+ * Renders a list of tag names as small secondary badges, wrapping when the
+ * column is narrow. Used as the default cell renderer for the `tags` column
+ * on resource tables that expose taggable resources (products, customers,
+ * orders).
+ */
+export function TagList({ tags, empty = '—' }: TagListProps) {
+ if (!tags || tags.length === 0) return <>{empty}</>
+ return (
+ <div className="flex flex-wrap gap-1">
+ {tags.map((tag) => (
+ <Badge key={tag} variant="secondary">
+ {tag}
+ </Badge>
+ ))}
+ </div>
+ )
+}
diff --git a/packages/admin/src/hooks/use-products.ts b/packages/admin/src/hooks/use-products.ts
index 6f6ad9bca4..1d764ef10c 100644
--- a/packages/admin/src/hooks/use-products.ts
+++ b/packages/admin/src/hooks/use-products.ts
@@ -1,5 +1,7 @@
import { useQuery } from '@tanstack/react-query'
+import i18n from 'i18next'
import { adminClient } from '@/client'
+import { useResourceMutation } from '@/hooks/use-resource-mutation'
import type { FilterRule } from '@/lib/table-registry'
interface UseProductsParams {
@@ -36,3 +38,63 @@ export function useProducts({
},
})
}
+
+// BulkActionBar renders its own count-aware toasts via `successMessage`/
+// `errorMessage` on each action, so these hooks opt out of the wrapper's
+// default toast. The shared `useBulkProductMutation` keeps the opt-out in
+// one place.
+
+type BulkStatusParams = Parameters<typeof adminClient.products.bulkStatusUpdate>[0]
+type BulkCategoriesParams = Parameters<typeof adminClient.products.bulkAddToCategories>[0]
+type BulkTagsParams = Parameters<typeof adminClient.products.bulkAddTags>[0]
+type BulkDestroyParams = Parameters<typeof adminClient.products.bulkDestroy>[0]
+
+function useBulkProductMutation<TData, TVariables>(
+ mutationFn: (params: TVariables) => Promise<TData>,
+) {
+ return useResourceMutation<TData, Error, TVariables>({
+ mutationFn,
+ successMessage: false,
+ errorMessage: false,
+ })
+}
+
+export function useBulkProductStatusUpdate() {
+ return useBulkProductMutation((p: BulkStatusParams) => adminClient.products.bulkStatusUpdate(p))
+}
+
+export function useBulkAddProductsToCategories() {
+ return useBulkProductMutation((p: BulkCategoriesParams) =>
+ adminClient.products.bulkAddToCategories(p),
+ )
+}
+
+export function useBulkRemoveProductsFromCategories() {
+ return useBulkProductMutation((p: BulkCategoriesParams) =>
+ adminClient.products.bulkRemoveFromCategories(p),
+ )
+}
+
+export function useBulkAddProductTags() {
+ return useBulkProductMutation((p: BulkTagsParams) => adminClient.products.bulkAddTags(p))
+}
+
+export function useBulkRemoveProductTags() {
+ return useBulkProductMutation((p: BulkTagsParams) => adminClient.products.bulkRemoveTags(p))
+}
+
+export function useBulkDestroyProducts() {
+ return useBulkProductMutation((p: BulkDestroyParams) => adminClient.products.bulkDestroy(p))
+}
+
+// Single-row clone — drives the row-action menu's "Duplicate" item. The
+// wrapper toasts on success and on non-422 failures, so the call site only
+// needs the resulting product to navigate to.
+export function useCloneProduct() {
+ return useResourceMutation({
+ mutationFn: (id: string) => adminClient.products.clone(id),
+ invalidate: [['products']],
+ successMessage: i18n.t('admin.pages.products.clone_succeeded'),
+ errorMessage: i18n.t('admin.pages.products.clone_failed'),
+ })
+}
diff --git a/packages/admin/src/locales/en.json b/packages/admin/src/locales/en.json
index e06b3f2b18..a5b3348972 100644
--- a/packages/admin/src/locales/en.json
+++ b/packages/admin/src/locales/en.json
@@ -2,6 +2,7 @@
"admin": {
"actions": {
"add": "Add",
+ "apply": "Apply",
"cancel": "Cancel",
"clear": "Clear",
"revoke": "Revoke",
@@ -37,6 +38,12 @@
"actions_menu": "Actions",
"more_actions": "More actions"
},
+ "row_actions": {
+ "menu_label": "Open actions",
+ "edit": "Edit",
+ "clone": "Duplicate",
+ "delete": "Delete"
+ },
"a11y": {
"breadcrumb": "Breadcrumb",
"toggle_sidebar": "Toggle sidebar",
@@ -683,6 +690,44 @@
"section_variants": "Variants",
"section_status": "Status",
"section_custom_fields": "Custom fields",
+ "clone_succeeded": "Product duplicated",
+ "clone_failed": "Failed to duplicate product",
+ "delete_succeeded": "Product deleted",
+ "delete_failed": "Failed to delete product",
+ "bulk": {
+ "set_status_action": "Set status…",
+ "add_categories_action": "Add to categories…",
+ "remove_categories_action": "Remove from categories…",
+ "add_tags_action": "Add tags…",
+ "remove_tags_action": "Remove tags…",
+ "delete_action": "Delete",
+ "status_sheet_title": "Set product status",
+ "status_sheet_description": "Pick the status to apply to the selected products.",
+ "categories_add_title": "Add to categories",
+ "categories_add_description": "Pick the categories to add these products to.",
+ "categories_remove_title": "Remove from categories",
+ "categories_remove_description": "Pick the categories to remove these products from.",
+ "tags_add_title": "Add tags",
+ "tags_add_description": "Pick or create tags to add to these products.",
+ "tags_remove_title": "Remove tags",
+ "tags_remove_description": "Pick tags to remove from these products.",
+ "delete_confirm": {
+ "title": "Delete {n} products?",
+ "message": "Selected products will be removed. This action cannot be undone."
+ },
+ "status_updated": "Updated status on {n} products",
+ "status_update_failed": "Failed to update product status",
+ "categories_added": "Added {n} products to categories",
+ "categories_add_failed": "Failed to add products to categories",
+ "categories_removed": "Removed {n} products from categories",
+ "categories_remove_failed": "Failed to remove products from categories",
+ "tags_added": "Added tags to {n} products",
+ "tags_add_failed": "Failed to add tags",
+ "tags_removed": "Removed tags from {n} products",
+ "tags_remove_failed": "Failed to remove tags",
+ "deleted": "Deleted {n} products",
+ "delete_failed": "Failed to delete products"
+ },
"media_empty": "No media yet.",
"media_upload": "Upload media",
"variants_empty": "No variants yet.",
@@ -924,6 +969,20 @@
"message": "{{name}} will be removed. Customers in this group are not deleted."
}
},
+ "tags": {
+ "bulk_add_action": "Add tags…",
+ "bulk_remove_action": "Remove tags…",
+ "bulk_added": "Added tags to {n} customers",
+ "bulk_removed": "Removed tags from {n} customers",
+ "bulk_add_failed": "Failed to add tags",
+ "bulk_remove_failed": "Failed to remove tags",
+ "picker": {
+ "add_title": "Add tags",
+ "add_description": "Pick or create tags to add to these customers.",
+ "remove_title": "Remove tags",
+ "remove_description": "Pick tags to remove from these customers."
+ }
+ },
"detail": {
"delete_label": "Delete customer",
"edit_profile_description": "Update the customer's profile information.",
@@ -1084,6 +1143,8 @@
"save_label": "Save product",
"delete_label": "Delete product",
"delete_confirm": "Are you sure you want to delete this product?",
+ "category_search_placeholder": "Search categories…",
+ "no_categories_found": "No categories found",
"media": {
"delete_confirm": "Delete this media? This cannot be undone.",
"drop_hint": "Drag & drop media here, or click to browse",
diff --git a/packages/admin/src/routes/_authenticated/$storeId/products/index.tsx b/packages/admin/src/routes/_authenticated/$storeId/products/index.tsx
index 0a543fde74..bee689a157 100644
--- a/packages/admin/src/routes/_authenticated/$storeId/products/index.tsx
+++ b/packages/admin/src/routes/_authenticated/$storeId/products/index.tsx
@@ -1,9 +1,54 @@
-import { createFileRoute } from '@tanstack/react-router'
-import { PlusIcon } from 'lucide-react'
+import type { Product } from '@spree/admin-sdk'
+import { createFileRoute, useNavigate } from '@tanstack/react-router'
+import {
+ CopyIcon,
+ EllipsisVerticalIcon,
+ FolderMinusIcon,
+ FolderPlusIcon,
+ PencilIcon,
+ PlusIcon,
+ TagIcon,
+ TagsIcon,
+ Trash2Icon,
+} from 'lucide-react'
+import { useCallback, useMemo, useState } from 'react'
+import { useTranslation } from 'react-i18next'
+import { toast } from 'sonner'
import { adminClient } from '@/client'
+import type { BulkAction, BulkActionFormProps } from '@/components/spree/bulk-action-bar'
+import { BulkDialog } from '@/components/spree/bulk-dialog'
+import { useConfirm } from '@/components/spree/confirm-dialog'
import { ExportButton } from '@/components/spree/export-button'
+import { ResourceMultiAutocomplete } from '@/components/spree/resource-multi-autocomplete'
import { ResourceTable, resourceSearchSchema } from '@/components/spree/resource-table'
+import { TagCombobox } from '@/components/spree/tag-combobox'
import { Button } from '@/components/ui/button'
+import {
+ DropdownMenu,
+ DropdownMenuContent,
+ DropdownMenuItem,
+ DropdownMenuTrigger,
+} from '@/components/ui/dropdown-menu'
+import { Field, FieldLabel } from '@/components/ui/field'
+import {
+ Select,
+ SelectContent,
+ SelectItem,
+ SelectTrigger,
+ SelectValue,
+} from '@/components/ui/select'
+import { categoryAutocompleteProps } from '@/hooks/use-categories'
+import { useDeleteProduct } from '@/hooks/use-product'
+import {
+ useBulkAddProductsToCategories,
+ useBulkAddProductTags,
+ useBulkDestroyProducts,
+ useBulkProductStatusUpdate,
+ useBulkRemoveProductsFromCategories,
+ useBulkRemoveProductTags,
+ useCloneProduct,
+} from '@/hooks/use-products'
+import { Subject } from '@/lib/permissions'
import '@/tables/products'
export const Route = createFileRoute('/_authenticated/$storeId/products/')({
@@ -11,15 +56,162 @@ export const Route = createFileRoute('/_authenticated/$storeId/products/')({
component: ProductsPage,
})
+type ProductStatus = 'draft' | 'active' | 'archived'
+type StatusFormValues = { status: ProductStatus }
+type CategoriesFormValues = { category_ids: string[] }
+type TagsFormValues = { tags: string[] }
+
function ProductsPage() {
+ const { t } = useTranslation()
+ const { storeId } = Route.useParams()
const searchParams = Route.useSearch()
+ const bulkStatus = useBulkProductStatusUpdate()
+ const bulkAddCategories = useBulkAddProductsToCategories()
+ const bulkRemoveCategories = useBulkRemoveProductsFromCategories()
+ const bulkAddTags = useBulkAddProductTags()
+ const bulkRemoveTags = useBulkRemoveProductTags()
+ const bulkDestroy = useBulkDestroyProducts()
+
+ // Memo: rebuilding the array (and the row-actions render-prop) on every
+ // mutation `isPending` toggle would force `<ResourceTable>` to re-render
+ // every visible row.
+ const bulkActions = useMemo<BulkAction<unknown>[]>(() => {
+ const statusAction: BulkAction<StatusFormValues> = {
+ key: 'set-status',
+ label: t('admin.pages.products.bulk.set_status_action'),
+ icon: <TagIcon className="size-4" />,
+ subject: Subject.Product,
+ form: (props) => <StatusPickerSheet {...props} />,
+ run: ({ ids, formValues }) => bulkStatus.mutateAsync({ ids, status: formValues!.status }),
+ successMessage: t('admin.pages.products.bulk.status_updated'),
+ errorMessage: t('admin.pages.products.bulk.status_update_failed'),
+ }
+
+ const addCategories: BulkAction<CategoriesFormValues> = {
+ key: 'add-to-categories',
+ label: t('admin.pages.products.bulk.add_categories_action'),
+ icon: <FolderPlusIcon className="size-4" />,
+ subject: Subject.Product,
+ form: (props) => (
+ <CategoryPickerSheet
+ {...props}
+ title={t('admin.pages.products.bulk.categories_add_title')}
+ description={t('admin.pages.products.bulk.categories_add_description')}
+ submitLabel={t('admin.actions.add')}
+ />
+ ),
+ run: ({ ids, formValues }) =>
+ bulkAddCategories.mutateAsync({ ids, category_ids: formValues!.category_ids }),
+ invalidate: [['categories']],
+ successMessage: t('admin.pages.products.bulk.categories_added'),
+ errorMessage: t('admin.pages.products.bulk.categories_add_failed'),
+ }
+
+ const removeCategories: BulkAction<CategoriesFormValues> = {
+ key: 'remove-from-categories',
+ label: t('admin.pages.products.bulk.remove_categories_action'),
+ icon: <FolderMinusIcon className="size-4" />,
+ subject: Subject.Product,
+ form: (props) => (
+ <CategoryPickerSheet
+ {...props}
+ title={t('admin.pages.products.bulk.categories_remove_title')}
+ description={t('admin.pages.products.bulk.categories_remove_description')}
+ submitLabel={t('admin.actions.remove')}
+ />
+ ),
+ run: ({ ids, formValues }) =>
+ bulkRemoveCategories.mutateAsync({ ids, category_ids: formValues!.category_ids }),
+ invalidate: [['categories']],
+ successMessage: t('admin.pages.products.bulk.categories_removed'),
+ errorMessage: t('admin.pages.products.bulk.categories_remove_failed'),
+ }
+
+ const addTags: BulkAction<TagsFormValues> = {
+ key: 'add-tags',
+ label: t('admin.pages.products.bulk.add_tags_action'),
+ icon: <TagsIcon className="size-4" />,
+ subject: Subject.Product,
+ form: (props) => (
+ <TagPickerSheet
+ {...props}
+ title={t('admin.pages.products.bulk.tags_add_title')}
+ description={t('admin.pages.products.bulk.tags_add_description')}
+ submitLabel={t('admin.actions.add')}
+ />
+ ),
+ run: ({ ids, formValues }) => bulkAddTags.mutateAsync({ ids, tags: formValues!.tags }),
+ successMessage: t('admin.pages.products.bulk.tags_added'),
+ errorMessage: t('admin.pages.products.bulk.tags_add_failed'),
+ }
+
+ const removeTags: BulkAction<TagsFormValues> = {
+ key: 'remove-tags',
+ label: t('admin.pages.products.bulk.remove_tags_action'),
+ icon: <TagsIcon className="size-4" />,
+ subject: Subject.Product,
+ form: (props) => (
+ <TagPickerSheet
+ {...props}
+ title={t('admin.pages.products.bulk.tags_remove_title')}
+ description={t('admin.pages.products.bulk.tags_remove_description')}
+ submitLabel={t('admin.actions.remove')}
+ />
+ ),
+ run: ({ ids, formValues }) => bulkRemoveTags.mutateAsync({ ids, tags: formValues!.tags }),
+ successMessage: t('admin.pages.products.bulk.tags_removed'),
+ errorMessage: t('admin.pages.products.bulk.tags_remove_failed'),
+ }
+
+ const deleteAction: BulkAction<unknown> = {
+ key: 'delete',
+ label: t('admin.pages.products.bulk.delete_action'),
+ icon: <Trash2Icon className="size-4" />,
+ subject: Subject.Product,
+ action: 'destroy',
+ confirm: {
+ title: t('admin.pages.products.bulk.delete_confirm.title'),
+ message: t('admin.pages.products.bulk.delete_confirm.message'),
+ confirmLabel: t('admin.actions.delete'),
+ variant: 'destructive',
+ },
+ run: ({ ids }) => bulkDestroy.mutateAsync({ ids }),
+ successMessage: t('admin.pages.products.bulk.deleted'),
+ errorMessage: t('admin.pages.products.bulk.delete_failed'),
+ }
+
+ return [
+ statusAction,
+ addCategories,
+ removeCategories,
+ addTags,
+ removeTags,
+ deleteAction,
+ ] as BulkAction<unknown>[]
+ }, [
+ t,
+ bulkStatus,
+ bulkAddCategories,
+ bulkRemoveCategories,
+ bulkAddTags,
+ bulkRemoveTags,
+ bulkDestroy,
+ ])
+
+ const renderRowActions = useCallback(
+ (product: Product) => <ProductRowActions product={product} storeId={storeId} />,
+ [storeId],
+ )
+
return (
<ResourceTable
tableKey="products"
queryKey="products"
queryFn={(params) => adminClient.products.list(params)}
searchParams={searchParams}
+ bulkActions={bulkActions}
+ rowActions={renderRowActions}
actions={(ctx) => (
<>
<ExportButton type="Spree::Exports::Products" {...ctx} />
@@ -32,3 +224,169 @@ function ProductsPage() {
/>
)
}
+
+function ProductRowActions({ product, storeId }: { product: Product; storeId: string }) {
+ const { t } = useTranslation()
+ const navigate = useNavigate()
+ const confirm = useConfirm()
+ const cloneMutation = useCloneProduct()
+ const deleteMutation = useDeleteProduct()
+
+ async function handleClone() {
+ const cloned = await cloneMutation.mutateAsync(product.id).catch(() => null)
+ if (!cloned) return
+ navigate({
+ to: '/$storeId/products/$productId',
+ params: { storeId, productId: cloned.id },
+ })
+ }
+
+ async function handleDelete() {
+ const ok = await confirm({
+ title: t('admin.products.delete_label'),
+ message: t('admin.products.delete_confirm'),
+ confirmLabel: t('admin.actions.delete'),
+ variant: 'destructive',
+ })
+ if (!ok) return
+
+ try {
+ await deleteMutation.mutateAsync(product.id)
+ toast.success(t('admin.pages.products.delete_succeeded'))
+ } catch {
+ toast.error(t('admin.pages.products.delete_failed'))
+ }
+ }
+
+ return (
+ <DropdownMenu>
+ <DropdownMenuTrigger asChild>
+ <Button variant="ghost" size="icon-xs" aria-label={t('admin.row_actions.menu_label')}>
+ <EllipsisVerticalIcon className="size-4" />
+ </Button>
+ </DropdownMenuTrigger>
+ <DropdownMenuContent align="end">
+ <DropdownMenuItem
+ onClick={() =>
+ navigate({
+ to: '/$storeId/products/$productId',
+ params: { storeId, productId: product.id },
+ })
+ }
+ >
+ <PencilIcon className="size-4" />
+ {t('admin.row_actions.edit')}
+ </DropdownMenuItem>
+ <DropdownMenuItem onClick={handleClone} disabled={cloneMutation.isPending}>
+ <CopyIcon className="size-4" />
+ {t('admin.row_actions.clone')}
+ </DropdownMenuItem>
+ <DropdownMenuItem
+ className="text-destructive focus:text-destructive"
+ onClick={handleDelete}
+ disabled={deleteMutation.isPending}
+ >
+ <Trash2Icon className="size-4" />
+ {t('admin.row_actions.delete')}
+ </DropdownMenuItem>
+ </DropdownMenuContent>
+ </DropdownMenu>
+ )
+}
+
+function StatusPickerSheet({ onSubmit, onCancel }: BulkActionFormProps<StatusFormValues>) {
+ const { t } = useTranslation()
+ const [status, setStatus] = useState<ProductStatus>('active')
+
+ return (
+ <BulkDialog
+ title={t('admin.pages.products.bulk.status_sheet_title')}
+ description={t('admin.pages.products.bulk.status_sheet_description')}
+ submitLabel={t('admin.actions.apply')}
+ onCancel={onCancel}
+ onSubmit={() => onSubmit({ status })}
+ >
+ <Field>
+ <FieldLabel>{t('admin.fields.status.label')}</FieldLabel>
+ <Select value={status} onValueChange={(v) => setStatus(v as ProductStatus)}>
+ <SelectTrigger>
+ <SelectValue />
+ </SelectTrigger>
+ <SelectContent>
+ <SelectItem value="draft">{t('admin.pages.products.status_options.draft')}</SelectItem>
+ <SelectItem value="active">
+ {t('admin.pages.products.status_options.active')}
+ </SelectItem>
+ <SelectItem value="archived">
+ {t('admin.pages.products.status_options.archived')}
+ </SelectItem>
+ </SelectContent>
+ </Select>
+ </Field>
+ </BulkDialog>
+ )
+}
+
+interface CopyProps {
+ title: string
+ description: string
+ submitLabel: string
+}
+
+function CategoryPickerSheet({
+ onSubmit,
+ onCancel,
+ title,
+ description,
+ submitLabel,
+}: BulkActionFormProps<CategoriesFormValues> & CopyProps) {
+ const { t } = useTranslation()
+ const [categoryIds, setCategoryIds] = useState<string[]>([])
+
+ return (
+ <BulkDialog
+ title={title}
+ description={description}
+ submitLabel={submitLabel}
+ submitDisabled={categoryIds.length === 0}
+ onCancel={onCancel}
+ onSubmit={() => onSubmit({ category_ids: categoryIds })}
+ >
+ <Field>
+ <FieldLabel>{t('admin.fields.product.category_ids.label')}</FieldLabel>
+ <ResourceMultiAutocomplete
+ {...categoryAutocompleteProps('bulk-products-category-picker')}
+ value={categoryIds}
+ onChange={setCategoryIds}
+ />
+ </Field>
+ </BulkDialog>
+ )
+}
+
+function TagPickerSheet({
+ onSubmit,
+ onCancel,
+ title,
+ description,
+ submitLabel,
+}: BulkActionFormProps<TagsFormValues> & CopyProps) {
+ const { t } = useTranslation()
+ const [tags, setTags] = useState<string[]>([])
+
+ return (
+ <BulkDialog
+ title={title}
+ description={description}
+ submitLabel={submitLabel}
+ submitDisabled={tags.length === 0}
+ onCancel={onCancel}
+ onSubmit={() => onSubmit({ tags })}
+ >
+ <Field>
+ <FieldLabel>{t('admin.fields.product.tags.label')}</FieldLabel>
+ <TagCombobox taggableType="Spree::Product" value={tags} onChange={setTags} />
+ </Field>
+ </BulkDialog>
+ )
+}
diff --git a/spree/api/app/controllers/concerns/spree/api/v3/bulk_operations.rb b/spree/api/app/controllers/concerns/spree/api/v3/bulk_operations.rb
new file mode 100644
index 0000000000..4232e2e3f9
--- /dev/null
+++ b/spree/api/app/controllers/concerns/spree/api/v3/bulk_operations.rb
@@ -0,0 +1,82 @@
+module Spree
+ module Api
+ module V3
+ # API-side counterpart to `Spree::Admin::BulkOperationsConcern`. Provides
+ # the shared tag bulk actions, the `bulk_collection` relation, and the
+ # `after_bulk_tags_change` hook controllers override (e.g. to reindex
+ # search + match automatic taxons). Shape mirrors the legacy concern so
+ # the two stay easy to keep in sync.
+ module BulkOperations
+ extend ActiveSupport::Concern
+
+ # POST /api/v3/admin/<resource>/bulk_add_tags
+ # Body: { ids: [...], tags: ['summer', 'sale'] }
+ def bulk_add_tags
+ authorize! :update, model_class
+
+ Spree::Tags::BulkAdd.call(tag_names: Array(params[:tags]), records: bulk_collection)
+ after_bulk_tags_change
+
+ render json: bulk_tags_response
+ end
+
+ # POST /api/v3/admin/<resource>/bulk_remove_tags
+ # Body: { ids: [...], tags: ['summer', 'sale'] }
+ def bulk_remove_tags
+ authorize! :update, model_class
+
+ Spree::Tags::BulkRemove.call(tag_names: Array(params[:tags]), records: bulk_collection)
+ after_bulk_tags_change
+
+ render json: bulk_tags_response
+ end
+
+ private
+
+ # Hook for controllers to perform additional work after bulk tag
+ # mutations — e.g. enqueueing search reindex jobs, re-matching
+ # automatic taxons. Mirrors `Spree::Admin::BulkOperationsConcern`.
+ def after_bulk_tags_change
+ end
+
+ # Slim ability-scoped relation targeted by the inbound `ids` param.
+ # Cross-store IDs and IDs the current admin can't update are silently
+ # dropped before any mutation runs. Mirrors the legacy concern's
+ # `bulk_collection` — no eager loads, because bulk endpoints only need
+ # `id` + `store_ids` per record.
+ def bulk_collection
+ @bulk_collection ||= begin
+ product_ids = decode_ids(params[:ids])
+ model_class.for_store(current_store).accessible_by(current_ability, :update)
+ .where(id: product_ids)
+ end
+ end
+
+ # Default shape for bulk tag responses; controllers override
+ # `bulk_record_count_key` to give the count its resource-named JSON key
+ # (e.g. `product_count`, `order_count`). Mirrors how the legacy admin
+ # concern delegates response shaping to the host controller.
+ def bulk_tags_response
+ {
+ bulk_record_count_key => bulk_collection.size,
+ tag_count: Array(params[:tags]).size
+ }
+ end
+
+ def bulk_record_count_key
+ :record_count
+ end
+
+ # Maps inbound IDs (a mix of prefixed `prod_…` strings and raw IDs) to
+ # raw IDs. Anything that isn't a valid prefixed ID is passed through
+ # verbatim, so legacy clients sending raw IDs keep working. Prefix
+ # decoding is pure — no DB lookup needed.
+ def decode_ids(ids)
+ Array(ids).map do |id|
+ Spree::PrefixedId.prefixed_id?(id) ? Spree::PrefixedId.decode_prefixed_id(id) : id
+ end
+ end
+ end
+ end
+ end
+end
diff --git a/spree/api/app/controllers/spree/api/v3/admin/products_controller.rb b/spree/api/app/controllers/spree/api/v3/admin/products_controller.rb
index 5e6870e904..511d3edb17 100644
--- a/spree/api/app/controllers/spree/api/v3/admin/products_controller.rb
+++ b/spree/api/app/controllers/spree/api/v3/admin/products_controller.rb
@@ -3,6 +3,8 @@ module Spree
module V3
module Admin
class ProductsController < ResourceController
+ include Spree::Api::V3::BulkOperations
+
scoped_resource :products
# POST /api/v3/admin/products/:id/clone
@@ -18,6 +20,48 @@ module Spree
end
end
+ # POST /api/v3/admin/products/bulk_status_update
+ # Body: { ids: [...], status: 'draft' | 'active' | 'archived' }
+ def bulk_status_update
+ authorize! :update, model_class
+
+ unless Spree::Product::STATUSES.include?(params[:status].to_s)
+ return render_error(
+ code: 'invalid_status',
+ message: Spree.t(:invalid_status, scope: 'errors.messages', default: 'Invalid status'),
+ status: :unprocessable_content
+ )
+ end
+
+ count = bulk_collection.update_all(status: params[:status], updated_at: Time.current)
+ # `update_all` skips `after_commit`, so the search index won't refresh on its own.
+ bulk_collection.each(&:enqueue_search_index)
+
+ render json: { product_count: count, status: params[:status] }
+ end
+
+ # POST /api/v3/admin/products/bulk_add_to_categories
+ # Body: { ids: [...], category_ids: [...] }
+ def bulk_add_to_categories
+ apply_categories(Spree::Taxons::AddProducts)
+ end
+
+ # POST /api/v3/admin/products/bulk_remove_from_categories
+ # Body: { ids: [...], category_ids: [...] }
+ def bulk_remove_from_categories
+ apply_categories(Spree::Taxons::RemoveProducts)
+ end
+
+ # DELETE /api/v3/admin/products/bulk_destroy
+ # Body: { ids: [...] }
+ def bulk_destroy
+ authorize! :destroy, model_class
+
+ destroyed = bulk_collection.count(&:destroy)
+
+ render json: { product_count: destroyed }
+ end
+
protected
def model_class
@@ -97,6 +141,31 @@ module Spree
def search_provider
@search_provider ||= Spree::SearchProvider::Database.new(current_store)
end
+
+ # Mirrors `Spree::Admin::ProductsController#after_bulk_tags_change`:
+ # tag changes can flip automatic-taxon matches, and `Tags::Bulk*`
+ # touch records via `touch_all` (which skips `after_commit`), so the
+ # search index needs an explicit kick.
+ def after_bulk_tags_change
+ Spree::Product.bulk_auto_match_taxons(current_store, bulk_collection.ids)
+ bulk_collection.each(&:enqueue_search_index)
+ end
+
+ def bulk_record_count_key
+ :product_count
+ end
+
+ def apply_categories(service)
+ authorize! :update, model_class
+
+ category_ids = decode_ids(params[:category_ids])
+ categories = current_store.taxons.accessible_by(current_ability, :update).where(id: category_ids)
+
+ service.call(taxons: categories, products: bulk_collection)
+ Spree::Product.bulk_auto_match_taxons(current_store, bulk_collection.ids)
+
+ render json: { product_count: bulk_collection.size, category_count: categories.size }
+ end
end
end
end
diff --git a/spree/api/config/routes.rb b/spree/api/config/routes.rb
index 58a1f32852..161f958445 100644
--- a/spree/api/config/routes.rb
+++ b/spree/api/config/routes.rb
@@ -158,6 +158,14 @@ Spree::Core::Engine.add_routes do
member do
post :clone
end
+ collection do
+ post :bulk_status_update
+ post :bulk_add_to_categories
+ post :bulk_remove_from_categories
+ post :bulk_add_tags
+ post :bulk_remove_tags
+ delete :bulk_destroy
+ end
resources :variants, controller: 'products/variants' do
resources :media, controller: 'media', only: [:index, :create, :update, :destroy]
end
diff --git a/spree/api/spec/controllers/spree/api/v3/admin/products_controller_spec.rb b/spree/api/spec/controllers/spree/api/v3/admin/products_controller_spec.rb
index 98e4d3074b..4951583ddd 100644
--- a/spree/api/spec/controllers/spree/api/v3/admin/products_controller_spec.rb
+++ b/spree/api/spec/controllers/spree/api/v3/admin/products_controller_spec.rb
@@ -558,4 +558,617 @@ RSpec.describe Spree::Api::V3::Admin::ProductsController, type: :controller do
expect(json_response['name']).to include('COPY OF')
end
end
+
+ describe 'POST #bulk_status_update' do
+ let!(:second_product) { create(:product, stores: [store], status: 'draft') }
+ let(:other_store) { create(:store) }
+ let!(:other_store_product) { create(:product, stores: [other_store], status: 'active') }
+
+ before { request.headers.merge!(headers) }
+
+ it 'updates status across the listed products and returns the count' do
+ post :bulk_status_update, params: {
+ ids: [product.prefixed_id, second_product.prefixed_id],
+ status: 'archived'
+ }, as: :json
+
+ expect(response).to have_http_status(:ok)
+ expect(json_response).to eq('product_count' => 2, 'status' => 'archived')
+ expect(product.reload.status).to eq('archived')
+ expect(second_product.reload.status).to eq('archived')
+ end
+
+ it 'accepts raw integer IDs alongside prefixed IDs' do
+ post :bulk_status_update, params: {
+ ids: [product.id.to_s, second_product.prefixed_id],
+ status: 'active'
+ }, as: :json
+
+ expect(response).to have_http_status(:ok)
+ expect(json_response['product_count']).to eq(2)
+ expect(product.reload.status).to eq('active')
+ expect(second_product.reload.status).to eq('active')
+ end
+
+ it 'silently drops products from other stores' do
+ post :bulk_status_update, params: {
+ ids: [product.prefixed_id, other_store_product.prefixed_id],
+ status: 'archived'
+ }, as: :json
+
+ expect(response).to have_http_status(:ok)
+ expect(json_response['product_count']).to eq(1)
+ expect(product.reload.status).to eq('archived')
+ expect(other_store_product.reload.status).to eq('active')
+ end
+
+ it 'returns 0 when none of the IDs are reachable' do
+ post :bulk_status_update, params: {
+ ids: [other_store_product.prefixed_id],
+ status: 'archived'
+ }, as: :json
+
+ expect(response).to have_http_status(:ok)
+ expect(json_response).to eq('product_count' => 0, 'status' => 'archived')
+ expect(other_store_product.reload.status).to eq('active')
+ end
+
+ it 'is a no-op when ids is empty' do
+ post :bulk_status_update, params: { ids: [], status: 'archived' }, as: :json
+
+ expect(response).to have_http_status(:ok)
+ expect(json_response).to eq('product_count' => 0, 'status' => 'archived')
+ end
+
+ it 'is a no-op when ids is omitted entirely' do
+ post :bulk_status_update, params: { status: 'archived' }, as: :json
+
+ expect(response).to have_http_status(:ok)
+ expect(json_response['product_count']).to eq(0)
+ end
+
+ it 'rejects an invalid status with 422' do
+ post :bulk_status_update, params: {
+ ids: [product.prefixed_id], status: 'bogus'
+ }, as: :json
+
+ expect(response).to have_http_status(:unprocessable_content)
+ expect(product.reload.status).not_to eq('bogus')
+ end
+
+ it 'rejects a missing status with 422' do
+ post :bulk_status_update, params: { ids: [product.prefixed_id] }, as: :json
+
+ expect(response).to have_http_status(:unprocessable_content)
+ end
+
+ # Mirrors `spree/admin/spec/controllers/.../products_controller_spec.rb`:
+ # asserts the reindex job is enqueued once per affected product.
+ it 'reindexes products' do
+ allow_any_instance_of(Spree::Product).to receive(:search_indexing_enabled?).and_return(true)
+
+ expect do
+ post :bulk_status_update, params: {
+ ids: [product.prefixed_id, second_product.prefixed_id], status: 'archived'
+ }, as: :json
+ end.to have_enqueued_job(Spree::SearchProvider::IndexJob).exactly(2).times
+ end
+
+ # Legacy spec sweeps every state machine state and asserts the row flips
+ # to `active`. Port verbatim — the destination is `active` here (the API's
+ # earlier sweep targeted each status as the *destination*, which only
+ # covers the validator). This version covers the actual transition.
+ shared_examples 'updates status to active' do |from_status|
+ let(:status) { from_status }
+
+ it "updates status to active" do
+ product.update!(status: from_status)
+
+ post :bulk_status_update, params: {
+ ids: [product.prefixed_id], status: 'active'
+ }, as: :json
+
+ expect(response).to have_http_status(:ok)
+ expect(product.reload.active?).to be(true)
+ end
+ end
+
+ Spree::Product.state_machine.states.map(&:name).each do |from_status|
+ context "when product is in #{from_status} status" do
+ it_behaves_like 'updates status to active', from_status
+ end
+ end
+ end
+
+ describe 'POST #bulk_add_to_categories' do
+ let(:taxonomy) { create(:taxonomy, store: store) }
+ let(:category) { create(:taxon, taxonomy: taxonomy) }
+ let(:other_category) { create(:taxon, taxonomy: taxonomy) }
+ let!(:second_product) { create(:product, stores: [store]) }
+
+ before { request.headers.merge!(headers) }
+
+ it 'attaches every product to every category' do
+ post :bulk_add_to_categories, params: {
+ ids: [product.prefixed_id, second_product.prefixed_id],
+ category_ids: [category.prefixed_id, other_category.prefixed_id]
+ }, as: :json
+
+ expect(response).to have_http_status(:ok)
+ expect(json_response).to eq('product_count' => 2, 'category_count' => 2)
+ expect(product.reload.taxons).to include(category, other_category)
+ expect(second_product.reload.taxons).to include(category, other_category)
+ end
+
+ it 'silently ignores categories from other stores' do
+ foreign_taxonomy = create(:taxonomy, store: create(:store))
+ foreign_category = create(:taxon, taxonomy: foreign_taxonomy)
+
+ post :bulk_add_to_categories, params: {
+ ids: [product.prefixed_id],
+ category_ids: [category.prefixed_id, foreign_category.prefixed_id]
+ }, as: :json
+
+ expect(response).to have_http_status(:ok)
+ expect(json_response['category_count']).to eq(1)
+ expect(product.reload.taxons).to include(category)
+ expect(product.reload.taxons).not_to include(foreign_category)
+ end
+
+ it 'silently drops products from other stores' do
+ other_store_product = create(:product, stores: [create(:store)])
+
+ post :bulk_add_to_categories, params: {
+ ids: [product.prefixed_id, other_store_product.prefixed_id],
+ category_ids: [category.prefixed_id]
+ }, as: :json
+
+ expect(response).to have_http_status(:ok)
+ expect(json_response['product_count']).to eq(1)
+ expect(other_store_product.reload.taxons).to be_empty
+ end
+
+ it 'is idempotent — re-adding existing categories is a no-op' do
+ product.taxons << category
+
+ expect do
+ post :bulk_add_to_categories, params: {
+ ids: [product.prefixed_id], category_ids: [category.prefixed_id]
+ }, as: :json
+ end.not_to change { product.reload.taxons.count }
+
+ expect(response).to have_http_status(:ok)
+ end
+
+ it 'is a no-op when category_ids is empty' do
+ post :bulk_add_to_categories, params: {
+ ids: [product.prefixed_id], category_ids: []
+ }, as: :json
+
+ expect(response).to have_http_status(:ok)
+ expect(json_response).to eq('product_count' => 1, 'category_count' => 0)
+ expect(product.reload.taxons).to be_empty
+ end
+
+ it 'is a no-op when ids is empty' do
+ post :bulk_add_to_categories, params: {
+ ids: [], category_ids: [category.prefixed_id]
+ }, as: :json
+
+ expect(response).to have_http_status(:ok)
+ expect(json_response).to eq('product_count' => 0, 'category_count' => 1)
+ end
+
+ it 'assigns the product positions on the category list' do
+ post :bulk_add_to_categories, params: {
+ ids: [product.prefixed_id, second_product.prefixed_id],
+ category_ids: [category.prefixed_id]
+ }, as: :json
+
+ positions = [
+ product.reload.classifications.find_by(taxon: category).position,
+ second_product.reload.classifications.find_by(taxon: category).position
+ ]
+ expect(positions).to contain_exactly(1, 2)
+ end
+
+ it 'touches the products' do
+ product_old_updated_at = product.updated_at
+ second_product_old_updated_at = second_product.updated_at
+
+ post :bulk_add_to_categories, params: {
+ ids: [product.prefixed_id, second_product.prefixed_id],
+ category_ids: [category.prefixed_id]
+ }, as: :json
+
+ expect(product.reload.updated_at).not_to eq(product_old_updated_at)
+ expect(second_product.reload.updated_at).not_to eq(second_product_old_updated_at)
+ end
+
+ it 'touches the category' do
+ category_old_updated_at = category.reload.updated_at
+
+ post :bulk_add_to_categories, params: {
+ ids: [product.prefixed_id],
+ category_ids: [category.prefixed_id]
+ }, as: :json
+
+ expect(category.reload.updated_at).not_to eq(category_old_updated_at)
+ end
+
+ # Legacy spec coverage: `bulk_auto_match_taxons` only enqueues jobs for
+ # products that are non-deleted and non-archived. Two active products
+ # should fire two jobs; archived + soft-deleted siblings are skipped.
+ describe 'auto matching taxons' do
+ let!(:active_a) { create(:product, stores: [store], status: :active) }
+ let!(:active_b) { create(:product, stores: [store], status: :active) }
+ let!(:archived) { create(:product, stores: [store], status: :archived) }
+ let!(:soft_deleted) { create(:product, stores: [store], status: :draft, deleted_at: Time.current) }
+
+ let(:bulk_ids) do
+ [active_a, active_b, archived, soft_deleted].map(&:prefixed_id)
+ end
+
+ before { Spree::Taxon.delete_all }
+
+ context 'on a store with automatic taxons' do
+ let!(:auto_taxon) { create(:automatic_taxon) }
+ let!(:plain_taxon) { create(:taxon) }
+
+ it 'auto matches taxons in bulk only for live active products' do
+ expect do
+ post :bulk_add_to_categories, params: {
+ ids: bulk_ids,
+ category_ids: [plain_taxon.prefixed_id]
+ }, as: :json
+ end.to have_enqueued_job(Spree::Products::AutoMatchTaxonsJob)
+ .on_queue(Spree.queues.taxons)
+ .exactly(:twice)
+
+ jobs = Spree::Products::AutoMatchTaxonsJob.queue_adapter.enqueued_jobs.last(2)
+ expect(jobs.map { |job| job['arguments'] }).to contain_exactly(
+ [active_a.id], [active_b.id]
+ )
+ end
+ end
+
+ context 'on a store without any automatic taxons' do
+ let!(:plain_taxon) { create(:taxon) }
+
+ it 'skips auto matching taxons' do
+ expect do
+ post :bulk_add_to_categories, params: {
+ ids: bulk_ids,
+ category_ids: [plain_taxon.prefixed_id]
+ }, as: :json
+ end.not_to have_enqueued_job(Spree::Products::AutoMatchTaxonsJob)
+ end
+ end
+ end
+ end
+
+ describe 'POST #bulk_remove_from_categories' do
+ let(:taxonomy) { create(:taxonomy, store: store) }
+ let(:category) { create(:taxon, taxonomy: taxonomy) }
+ let(:other_category) { create(:taxon, taxonomy: taxonomy) }
+ let!(:second_product) { create(:product, stores: [store]) }
+
+ before do
+ request.headers.merge!(headers)
+ product.taxons << [category, other_category]
+ second_product.taxons << category
+ end
+
+ it 'detaches every product from every category' do
+ post :bulk_remove_from_categories, params: {
+ ids: [product.prefixed_id, second_product.prefixed_id],
+ category_ids: [category.prefixed_id]
+ }, as: :json
+
+ expect(response).to have_http_status(:ok)
+ expect(json_response).to eq('product_count' => 2, 'category_count' => 1)
+ expect(product.reload.taxons).not_to include(category)
+ expect(product.reload.taxons).to include(other_category)
+ expect(second_product.reload.taxons).not_to include(category)
+ end
+
+ it 'is a no-op for products not in the category' do
+ stray = create(:product, stores: [store])
+
+ post :bulk_remove_from_categories, params: {
+ ids: [stray.prefixed_id], category_ids: [category.prefixed_id]
+ }, as: :json
+
+ expect(response).to have_http_status(:ok)
+ expect(stray.reload.taxons).to be_empty
+ end
+
+ it 'touches the products' do
+ product_old_updated_at = product.updated_at
+ second_product_old_updated_at = second_product.updated_at
+
+ post :bulk_remove_from_categories, params: {
+ ids: [product.prefixed_id, second_product.prefixed_id],
+ category_ids: [category.prefixed_id]
+ }, as: :json
+
+ expect(product.reload.updated_at).not_to eq(product_old_updated_at)
+ expect(second_product.reload.updated_at).not_to eq(second_product_old_updated_at)
+ end
+
+ it 'touches the categories' do
+ category_old_updated_at = category.reload.updated_at
+ other_category_old_updated_at = other_category.reload.updated_at
+
+ post :bulk_remove_from_categories, params: {
+ ids: [product.prefixed_id],
+ category_ids: [category.prefixed_id, other_category.prefixed_id]
+ }, as: :json
+
+ expect(category.reload.updated_at).not_to eq(category_old_updated_at)
+ expect(other_category.reload.updated_at).not_to eq(other_category_old_updated_at)
+ end
+
+ # Legacy spec: after products are detached, surviving classifications
+ # collapse their `position` values to a contiguous sequence (1, 2, …).
+ it 'reassigns the positions of surviving products on the category list' do
+ survivor = create(:product, stores: [store])
+ latecomer = create(:product, stores: [store])
+ survivor.taxons << category
+ latecomer.taxons << category
+
+ post :bulk_remove_from_categories, params: {
+ ids: [product.prefixed_id, second_product.prefixed_id],
+ category_ids: [category.prefixed_id]
+ }, as: :json
+
+ positions = [
+ survivor.reload.classifications.find_by(taxon: category)&.position,
+ latecomer.reload.classifications.find_by(taxon: category)&.position
+ ].compact.sort
+
+ expect(positions).to eq([1, 2])
+ end
+
+ describe 'auto matching taxons' do
+ let!(:active_a) { create(:product, stores: [store], status: :active) }
+ let!(:active_b) { create(:product, stores: [store], status: :active) }
+ let!(:archived) { create(:product, stores: [store], status: :archived) }
+ let!(:soft_deleted) { create(:product, stores: [store], status: :draft, deleted_at: Time.current) }
+
+ let(:bulk_ids) do
+ [active_a, active_b, archived, soft_deleted].map(&:prefixed_id)
+ end
+
+ before { Spree::Taxon.delete_all }
+
+ context 'on a store with automatic taxons' do
+ let!(:auto_taxon) { create(:automatic_taxon) }
+ let!(:plain_taxon) { create(:taxon) }
+
+ it 'auto matches taxons in bulk only for live active products' do
+ expect do
+ post :bulk_remove_from_categories, params: {
+ ids: bulk_ids,
+ category_ids: [plain_taxon.prefixed_id]
+ }, as: :json
+ end.to have_enqueued_job(Spree::Products::AutoMatchTaxonsJob)
+ .on_queue(Spree.queues.taxons)
+ .exactly(:twice)
+
+ jobs = Spree::Products::AutoMatchTaxonsJob.queue_adapter.enqueued_jobs.last(2)
+ expect(jobs.map { |job| job['arguments'] }).to contain_exactly(
+ [active_a.id], [active_b.id]
+ )
+ end
+ end
+
+ context 'on a store without any automatic taxons' do
+ let!(:plain_taxon) { create(:taxon) }
+
+ it 'skips auto matching taxons' do
+ expect do
+ post :bulk_remove_from_categories, params: {
+ ids: bulk_ids,
+ category_ids: [plain_taxon.prefixed_id]
+ }, as: :json
+ end.not_to have_enqueued_job(Spree::Products::AutoMatchTaxonsJob)
+ end
+ end
+ end
+ end
+
+ describe 'POST #bulk_add_tags' do
+ let!(:second_product) { create(:product, stores: [store]) }
+
+ before { request.headers.merge!(headers) }
+
+ it 'adds the listed tags to every listed product' do
+ post :bulk_add_tags, params: {
+ ids: [product.prefixed_id, second_product.prefixed_id],
+ tags: %w[summer sale]
+ }, as: :json
+
+ expect(response).to have_http_status(:ok)
+ expect(json_response).to eq('product_count' => 2, 'tag_count' => 2)
+ expect(product.reload.tag_list).to include('summer', 'sale')
+ expect(second_product.reload.tag_list).to include('summer', 'sale')
+ end
+
+ it 'is idempotent — re-adding the same tag does not duplicate it' do
+ product.tag_list.add('summer')
+ product.save!
+
+ post :bulk_add_tags, params: {
+ ids: [product.prefixed_id], tags: ['summer']
+ }, as: :json
+
+ expect(response).to have_http_status(:ok)
+ expect(product.reload.tag_list.count { |t| t == 'summer' }).to eq(1)
+ end
+
+ it 'strips whitespace from tag names' do
+ post :bulk_add_tags, params: {
+ ids: [product.prefixed_id], tags: [' summer ']
+ }, as: :json
+
+ expect(response).to have_http_status(:ok)
+ expect(product.reload.tag_list).to include('summer')
+ expect(product.reload.tag_list).not_to include(' summer ')
+ end
+
+ it 'silently drops products from other stores' do
+ other_store_product = create(:product, stores: [create(:store)])
+
+ post :bulk_add_tags, params: {
+ ids: [product.prefixed_id, other_store_product.prefixed_id],
+ tags: ['summer']
+ }, as: :json
+
+ expect(response).to have_http_status(:ok)
+ expect(json_response['product_count']).to eq(1)
+ expect(other_store_product.reload.tag_list).to be_empty
+ end
+
+ it 'is a no-op when tags is empty' do
+ post :bulk_add_tags, params: {
+ ids: [product.prefixed_id], tags: []
+ }, as: :json
+
+ expect(response).to have_http_status(:ok)
+ expect(json_response).to eq('product_count' => 1, 'tag_count' => 0)
+ expect(product.reload.tag_list).to be_empty
+ end
+
+ it 'is a no-op when ids is empty' do
+ post :bulk_add_tags, params: { ids: [], tags: ['summer'] }, as: :json
+
+ expect(response).to have_http_status(:ok)
+ expect(json_response).to eq('product_count' => 0, 'tag_count' => 1)
+ end
+
+ it 'reindexes products' do
+ allow_any_instance_of(Spree::Product).to receive(:search_indexing_enabled?).and_return(true)
+
+ expect do
+ post :bulk_add_tags, params: {
+ ids: [product.prefixed_id, second_product.prefixed_id],
+ tags: ['summer']
+ }, as: :json
+ end.to have_enqueued_job(Spree::SearchProvider::IndexJob).exactly(2).times
+ end
+ end
+
+ describe 'POST #bulk_remove_tags' do
+ let!(:second_product) { create(:product, stores: [store]) }
+
+ before do
+ request.headers.merge!(headers)
+ product.tag_list.add('summer', 'sale')
+ product.save!
+ second_product.tag_list.add('summer')
+ second_product.save!
+ end
+
+ it 'removes the listed tags from every listed product' do
+ post :bulk_remove_tags, params: {
+ ids: [product.prefixed_id, second_product.prefixed_id],
+ tags: ['summer']
+ }, as: :json
+
+ expect(response).to have_http_status(:ok)
+ expect(json_response).to eq('product_count' => 2, 'tag_count' => 1)
+ expect(product.reload.tag_list).not_to include('summer')
+ expect(product.reload.tag_list).to include('sale')
+ expect(second_product.reload.tag_list).not_to include('summer')
+ end
+
+ it 'is a no-op for products without the tag' do
+ stray = create(:product, stores: [store])
+
+ post :bulk_remove_tags, params: {
+ ids: [stray.prefixed_id], tags: ['summer']
+ }, as: :json
+
+ expect(response).to have_http_status(:ok)
+ expect(stray.reload.tag_list).to be_empty
+ end
+
+ it 'is a no-op for tags that don\'t exist' do
+ post :bulk_remove_tags, params: {
+ ids: [product.prefixed_id], tags: ['nonexistent-tag']
+ }, as: :json
+
+ expect(response).to have_http_status(:ok)
+ expect(product.reload.tag_list).to include('summer', 'sale')
+ end
+
+ it 'reindexes products' do
+ allow_any_instance_of(Spree::Product).to receive(:search_indexing_enabled?).and_return(true)
+
+ expect do
+ post :bulk_remove_tags, params: {
+ ids: [product.prefixed_id, second_product.prefixed_id],
+ tags: ['summer']
+ }, as: :json
+ end.to have_enqueued_job(Spree::SearchProvider::IndexJob).exactly(2).times
+ end
+ end
+
+ describe 'DELETE #bulk_destroy' do
+ let!(:second_product) { create(:product, stores: [store]) }
+
+ before { request.headers.merge!(headers) }
+
+ it 'soft-deletes the listed products' do
+ delete :bulk_destroy, params: {
+ ids: [product.prefixed_id, second_product.prefixed_id]
+ }, as: :json
+
+ expect(response).to have_http_status(:ok)
+ expect(json_response).to eq('product_count' => 2)
+ expect(product.reload.deleted_at).not_to be_nil
+ expect(second_product.reload.deleted_at).not_to be_nil
+ end
+
+ it 'silently drops products from other stores' do
+ other_store_product = create(:product, stores: [create(:store)])
+
+ delete :bulk_destroy, params: {
+ ids: [product.prefixed_id, other_store_product.prefixed_id]
+ }, as: :json
+
+ expect(response).to have_http_status(:ok)
+ expect(json_response['product_count']).to eq(1)
+ expect(other_store_product.reload.deleted_at).to be_nil
+ end
+
+ it 'is a no-op when ids is empty' do
+ expect do
+ delete :bulk_destroy, params: { ids: [] }, as: :json
+ end.not_to change(Spree::Product.where(deleted_at: nil), :count)
+
+ expect(response).to have_http_status(:ok)
+ expect(json_response).to eq('product_count' => 0)
+ end
+
+ it 'is a no-op when ids is omitted entirely' do
+ delete :bulk_destroy, params: {}, as: :json
+
+ expect(response).to have_http_status(:ok)
+ expect(json_response['product_count']).to eq(0)
+ end
+
+ it 'returns 0 when the only IDs reference unreachable products' do
+ other_store_product = create(:product, stores: [create(:store)])
+
+ delete :bulk_destroy, params: {
+ ids: [other_store_product.prefixed_id]
+ }, as: :json
+
+ expect(response).to have_http_status(:ok)
+ expect(json_response).to eq('product_count' => 0)
+ expect(other_store_product.reload.deleted_at).to be_nil
+ end
+ end
end
diff --git a/spree/api/spec/integration/spree/api/v3/admin/products_spec.rb b/spree/api/spec/integration/spree/api/v3/admin/products_spec.rb
index 81df4a7156..87776e54e6 100644
--- a/spree/api/spec/integration/spree/api/v3/admin/products_spec.rb
+++ b/spree/api/spec/integration/spree/api/v3/admin/products_spec.rb
@@ -322,4 +322,255 @@ RSpec.describe 'Admin Products API', type: :request, swagger_doc: 'api-reference
end
end
end
+
+ path '/api/v3/admin/products/bulk_status_update' do
+ post 'Bulk-update product status' do
+ tags 'Product Catalog'
+ consumes 'application/json'
+ produces 'application/json'
+ security [api_key: [], bearer_auth: []]
+ description <<~DESC
+ Sets `status` on each product in `ids`. Reindexes the affected products
+ for search. Cross-store IDs are silently dropped. Returns counts.
+ DESC
+ admin_scope :write, :products
+
+ parameter name: 'x-spree-api-key', in: :header, type: :string, required: true
+ parameter name: :Authorization, in: :header, type: :string, required: true
+ parameter name: :body, in: :body, schema: {
+ type: :object,
+ required: %w[ids status],
+ properties: {
+ ids: { type: :array, items: { type: :string }, example: ['prod_UkLWZg9DAJ'] },
+ status: { type: :string, enum: %w[draft active archived], example: 'archived' }
+ }
+ }
+
+ response '200', 'products updated' do
+ let(:'x-spree-api-key') { secret_api_key.plaintext_token }
+ let(:body) { { ids: [product.prefixed_id], status: 'archived' } }
+
+ schema type: :object, properties: {
+ product_count: { type: :integer },
+ status: { type: :string }
+ }
+
+ run_test! do |response|
+ data = JSON.parse(response.body)
+ expect(data).to eq('product_count' => 1, 'status' => 'archived')
+ expect(product.reload.status).to eq('archived')
+ end
+ end
+
+ response '422', 'invalid status' do
+ let(:'x-spree-api-key') { secret_api_key.plaintext_token }
+ let(:body) { { ids: [product.prefixed_id], status: 'bogus' } }
+
+ schema '$ref' => '#/components/schemas/ErrorResponse'
+
+ run_test!
+ end
+
+ response '200', 'cross-store products silently dropped' do
+ let(:'x-spree-api-key') { secret_api_key.plaintext_token }
+ let(:other_store_product) { create(:product, stores: [create(:store)]) }
+ let(:body) { { ids: [other_store_product.prefixed_id], status: 'archived' } }
+
+ run_test! do |response|
+ data = JSON.parse(response.body)
+ expect(data['product_count']).to eq(0)
+ expect(other_store_product.reload.status).not_to eq('archived')
+ end
+ end
+ end
+ end
+
+ path '/api/v3/admin/products/bulk_add_to_categories' do
+ post 'Bulk-add products to categories' do
+ tags 'Product Catalog'
+ consumes 'application/json'
+ produces 'application/json'
+ security [api_key: [], bearer_auth: []]
+ description <<~DESC
+ Attaches each product in `ids` to every category (taxon) in `category_ids`.
+ Categories from sibling stores are silently ignored.
+ DESC
+ admin_scope :write, :products
+
+ parameter name: 'x-spree-api-key', in: :header, type: :string, required: true
+ parameter name: :Authorization, in: :header, type: :string, required: true
+ parameter name: :body, in: :body, schema: {
+ type: :object,
+ required: %w[ids category_ids],
+ properties: {
+ ids: { type: :array, items: { type: :string } },
+ category_ids: { type: :array, items: { type: :string } }
+ }
+ }
+
+ response '200', 'products added to categories' do
+ let(:'x-spree-api-key') { secret_api_key.plaintext_token }
+ let(:taxonomy) { create(:taxonomy, store: store) }
+ let(:category) { create(:taxon, taxonomy: taxonomy) }
+ let(:body) { { ids: [product.prefixed_id], category_ids: [category.prefixed_id] } }
+
+ schema type: :object, properties: {
+ product_count: { type: :integer },
+ category_count: { type: :integer }
+ }
+
+ run_test! do |response|
+ data = JSON.parse(response.body)
+ expect(data).to eq('product_count' => 1, 'category_count' => 1)
+ expect(product.reload.taxons).to include(category)
+ end
+ end
+ end
+ end
+
+ path '/api/v3/admin/products/bulk_remove_from_categories' do
+ post 'Bulk-remove products from categories' do
+ tags 'Product Catalog'
+ consumes 'application/json'
+ produces 'application/json'
+ security [api_key: [], bearer_auth: []]
+ description 'Detaches each product in `ids` from every category in `category_ids`.'
+ admin_scope :write, :products
+
+ parameter name: 'x-spree-api-key', in: :header, type: :string, required: true
+ parameter name: :Authorization, in: :header, type: :string, required: true
+ parameter name: :body, in: :body, schema: {
+ type: :object,
+ required: %w[ids category_ids],
+ properties: {
+ ids: { type: :array, items: { type: :string } },
+ category_ids: { type: :array, items: { type: :string } }
+ }
+ }
+
+ response '200', 'products removed from categories' do
+ let(:'x-spree-api-key') { secret_api_key.plaintext_token }
+ let(:taxonomy) { create(:taxonomy, store: store) }
+ let(:category) { create(:taxon, taxonomy: taxonomy) }
+ let(:body) { { ids: [product.prefixed_id], category_ids: [category.prefixed_id] } }
+
+ before { product.taxons << category }
+
+ run_test! do |response|
+ data = JSON.parse(response.body)
+ expect(data).to eq('product_count' => 1, 'category_count' => 1)
+ expect(product.reload.taxons).not_to include(category)
+ end
+ end
+ end
+ end
+
+ path '/api/v3/admin/products/bulk_add_tags' do
+ post 'Bulk-add tags to products' do
+ tags 'Product Catalog'
+ consumes 'application/json'
+ produces 'application/json'
+ security [api_key: [], bearer_auth: []]
+ description 'Adds each tag name in `tags` to every product in `ids`. Tags are upserted by name.'
+ admin_scope :write, :products
+
+ parameter name: 'x-spree-api-key', in: :header, type: :string, required: true
+ parameter name: :Authorization, in: :header, type: :string, required: true
+ parameter name: :body, in: :body, schema: {
+ type: :object,
+ required: %w[ids tags],
+ properties: {
+ ids: { type: :array, items: { type: :string } },
+ tags: { type: :array, items: { type: :string }, example: %w[summer sale] }
+ }
+ }
+
+ response '200', 'tags added' do
+ let(:'x-spree-api-key') { secret_api_key.plaintext_token }
+ let(:body) { { ids: [product.prefixed_id], tags: %w[summer sale] } }
+
+ schema type: :object, properties: {
+ product_count: { type: :integer },
+ tag_count: { type: :integer }
+ }
+
+ run_test! do |response|
+ data = JSON.parse(response.body)
+ expect(data).to eq('product_count' => 1, 'tag_count' => 2)
+ expect(product.reload.tag_list).to include('summer', 'sale')
+ end
+ end
+ end
+ end
+
+ path '/api/v3/admin/products/bulk_remove_tags' do
+ post 'Bulk-remove tags from products' do
+ tags 'Product Catalog'
+ consumes 'application/json'
+ produces 'application/json'
+ security [api_key: [], bearer_auth: []]
+ description 'Removes each tag in `tags` from every product in `ids`.'
+ admin_scope :write, :products
+
+ parameter name: 'x-spree-api-key', in: :header, type: :string, required: true
+ parameter name: :Authorization, in: :header, type: :string, required: true
+ parameter name: :body, in: :body, schema: {
+ type: :object,
+ required: %w[ids tags],
+ properties: {
+ ids: { type: :array, items: { type: :string } },
+ tags: { type: :array, items: { type: :string } }
+ }
+ }
+
+ response '200', 'tags removed' do
+ let(:'x-spree-api-key') { secret_api_key.plaintext_token }
+ let(:body) { { ids: [product.prefixed_id], tags: ['summer'] } }
+
+ before { product.tag_list.add('summer'); product.save! }
+
+ run_test! do |response|
+ data = JSON.parse(response.body)
+ expect(data).to eq('product_count' => 1, 'tag_count' => 1)
+ expect(product.reload.tag_list).not_to include('summer')
+ end
+ end
+ end
+ end
+
+ path '/api/v3/admin/products/bulk_destroy' do
+ delete 'Bulk-delete products' do
+ tags 'Product Catalog'
+ consumes 'application/json'
+ produces 'application/json'
+ security [api_key: [], bearer_auth: []]
+ description 'Soft-deletes each product in `ids`. Returns the count actually destroyed.'
+ admin_scope :write, :products
+
+ parameter name: 'x-spree-api-key', in: :header, type: :string, required: true
+ parameter name: :Authorization, in: :header, type: :string, required: true
+ parameter name: :body, in: :body, schema: {
+ type: :object,
+ required: %w[ids],
+ properties: {
+ ids: { type: :array, items: { type: :string } }
+ }
+ }
+
+ response '200', 'products deleted' do
+ let(:'x-spree-api-key') { secret_api_key.plaintext_token }
+ let(:body) { { ids: [product.prefixed_id] } }
+
+ schema type: :object, properties: {
+ product_count: { type: :integer }
+ }
+
+ run_test! do |response|
+ data = JSON.parse(response.body)
+ expect(data).to eq('product_count' => 1)
+ expect(product.reload.deleted_at).not_to be_nil
+ end
+ end
+ end
+ end
end