fluentcart-developer 2.0.2 → 2.3.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +59 -59
- package/dist/cards/fluentcart/tools.d.ts.map +1 -1
- package/dist/cards/fluentcart/tools.js +184 -18
- package/dist/cards/fluentcart/tools.js.map +1 -1
- package/dist/skills/fluentcart-developer/.claude-plugin/plugin.json +12 -12
- package/dist/skills/fluentcart-developer/.mcp.json +11 -11
- package/dist/skills/fluentcart-developer/examples/fluentcart-starter-child-theme/fluent-cart/checkout.php +32 -32
- package/dist/skills/fluentcart-developer/examples/fluentcart-starter-child-theme/functions.php +40 -40
- package/dist/skills/fluentcart-developer/examples/sample-fee-surcharge-plugin/fluentcart-fee-surcharge.php +38 -38
- package/dist/skills/fluentcart-developer/references/action-hooks-cart-checkout.md +1355 -1355
- package/dist/skills/fluentcart-developer/references/action-hooks-customers-users.md +266 -266
- package/dist/skills/fluentcart-developer/references/action-hooks-licenses.md +855 -855
- package/dist/skills/fluentcart-developer/references/action-hooks-orders.md +631 -631
- package/dist/skills/fluentcart-developer/references/action-hooks-payments-integrations.md +963 -963
- package/dist/skills/fluentcart-developer/references/action-hooks-products-coupons.md +585 -585
- package/dist/skills/fluentcart-developer/references/action-hooks-subscriptions.md +661 -661
- package/dist/skills/fluentcart-developer/references/database-models-query-builder.md +194 -194
- package/dist/skills/fluentcart-developer/references/database-models-reference.md +604 -604
- package/dist/skills/fluentcart-developer/references/engineering-notes.md +154 -154
- package/dist/skills/fluentcart-developer/references/fee-system-guide.md +449 -449
- package/dist/skills/fluentcart-developer/references/filter-hooks-cart-checkout.md +1202 -1202
- package/dist/skills/fluentcart-developer/references/filter-hooks-integrations-advanced.md +1598 -1598
- package/dist/skills/fluentcart-developer/references/filter-hooks-products-pricing.md +628 -628
- package/dist/skills/fluentcart-developer/references/filter-hooks-settings-configuration.md +1177 -1177
- package/dist/skills/fluentcart-developer/references/fluentcart-developer-guide.md +154 -154
- package/dist/skills/fluentcart-developer/references/ghost-product-selling.md +458 -458
- package/dist/skills/fluentcart-developer/references/modules-and-extensions-reference.md +224 -224
- package/dist/skills/fluentcart-developer/references/payment-gateway-integration.md +761 -761
- package/dist/skills/fluentcart-developer/references/rest-api-customer-profile.md +190 -190
- package/dist/skills/fluentcart-developer/references/rest-api-customers.md +1121 -1121
- package/dist/skills/fluentcart-developer/references/rest-api-dashboard-utilities.md +219 -219
- package/dist/skills/fluentcart-developer/references/rest-api-email-notifications.md +619 -619
- package/dist/skills/fluentcart-developer/references/rest-api-files.md +290 -290
- package/dist/skills/fluentcart-developer/references/rest-api-integrations.md +324 -324
- package/dist/skills/fluentcart-developer/references/rest-api-labels-attributes.md +321 -321
- package/dist/skills/fluentcart-developer/references/rest-api-order-bumps.md +200 -200
- package/dist/skills/fluentcart-developer/references/rest-api-overview.md +131 -131
- package/dist/skills/fluentcart-developer/references/rest-api-public-shop.md +172 -172
- package/dist/skills/fluentcart-developer/references/rest-api-reference.md +552 -552
- package/dist/skills/fluentcart-developer/references/rest-api-reports.md +377 -377
- package/dist/skills/fluentcart-developer/references/rest-api-roles-permissions.md +147 -147
- package/dist/skills/fluentcart-developer/references/rest-api-settings.md +528 -528
- package/dist/skills/fluentcart-developer/references/rest-api-shipping.md +799 -799
- package/dist/skills/fluentcart-developer/references/rest-api-tax.md +356 -356
- package/dist/skills/fluentcart-developer/references/subscription-customization.md +197 -197
- package/dist/skills/fluentcart-developer/scripts/cli.js +1 -1
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/package.json +65 -65
- package/dist/skills/fluentcart-developer/references/client-integration-contract.md +0 -299
- package/dist/skills/fluentcart-developer/references/device-licensing-and-hardware-tracking.md +0 -241
- package/dist/skills/fluentcart-developer/references/trial-abuse-prevention.md +0 -304
|
@@ -1,321 +1,321 @@
|
|
|
1
|
-
# Labels & Attributes API
|
|
2
|
-
|
|
3
|
-
Manage organizational labels for orders and customers, and product attribute groups and terms used for variation options in FluentCart.
|
|
4
|
-
|
|
5
|
-
**Base URL:** `https://your-site.com/wp-json/fluent-cart/v2`
|
|
6
|
-
**Policies:** `LabelPolicy` (Labels) / `ProductPolicy` (Attributes)
|
|
7
|
-
|
|
8
|
-
---
|
|
9
|
-
|
|
10
|
-
## Endpoints Overview
|
|
11
|
-
|
|
12
|
-
| Group | Method | Endpoint | Permission / Policy | Request Class | Description |
|
|
13
|
-
|-------|--------|----------|--------------------|---------------|-------------|
|
|
14
|
-
| **Labels** | GET | `/labels` | `labels/view` | — | Retrieve all labels |
|
|
15
|
-
| | POST | `/labels` | `labels/manage` | `LabelRequest` | Create label and optionally bind to entity |
|
|
16
|
-
| | POST | `/labels/update-label-selections` | `labels/manage` | — | Sync label selection for order/customer |
|
|
17
|
-
| **Attribute Groups** | GET | `/options/attr/groups` | `products/view` | — | List attribute groups (Color, Size, etc.) |
|
|
18
|
-
| | POST | `/options/attr/group` | `products/create` | `AttrGroupRequest` | Create attribute group |
|
|
19
|
-
| | GET | `/options/attr/group/{group_id}` | `products/view` | — | Get single attribute group (with terms) |
|
|
20
|
-
| | PUT | `/options/attr/group/{group_id}` | `products/edit` | `AttrGroupRequest` | Update attribute group |
|
|
21
|
-
| | DELETE | `/options/attr/group/{group_id}` | `products/delete` | — | Delete attribute group (guarded if in use) |
|
|
22
|
-
| **Attribute Terms** | GET | `/options/attr/group/{id}/terms` | `products/view` | — | List terms within attribute group |
|
|
23
|
-
| | POST | `/options/attr/group/{id}/term` | `products/create` | `AttrTermRequest` | Create term within attribute group |
|
|
24
|
-
| | POST | `/options/attr/group/{id}/term/{term_id}` | `products/edit` | `AttrTermRequest` | Update attribute term |
|
|
25
|
-
| | DELETE | `/options/attr/group/{id}/term/{term_id}` | `products/delete` | — | Delete attribute term (guarded if in use) |
|
|
26
|
-
| | POST | `/options/attr/group/{id}/term/{term_id}/serial` | `products/edit` | — | Shift term position (`up` or `down`) |
|
|
27
|
-
|
|
28
|
-
---
|
|
29
|
-
|
|
30
|
-
## Labels
|
|
31
|
-
|
|
32
|
-
Labels are tags that attach to orders, customers, or other entities via a polymorphic relationship for organizational filtering.
|
|
33
|
-
|
|
34
|
-
**Prefix:** `/fluent-cart/v2/labels` | **Policy:** `LabelPolicy`
|
|
35
|
-
|
|
36
|
-
### List Labels
|
|
37
|
-
|
|
38
|
-
`GET /fluent-cart/v2/labels`
|
|
39
|
-
|
|
40
|
-
#### Permission
|
|
41
|
-
|
|
42
|
-
`labels/view`
|
|
43
|
-
|
|
44
|
-
#### Response
|
|
45
|
-
|
|
46
|
-
```json
|
|
47
|
-
{
|
|
48
|
-
"labels": {
|
|
49
|
-
"labels": [
|
|
50
|
-
{ "id": 1, "value": "VIP" },
|
|
51
|
-
{ "id": 2, "value": "Wholesale" },
|
|
52
|
-
{ "id": 3, "value": "Priority" }
|
|
53
|
-
]
|
|
54
|
-
}
|
|
55
|
-
}
|
|
56
|
-
```
|
|
57
|
-
|
|
58
|
-
---
|
|
59
|
-
|
|
60
|
-
### Create Label
|
|
61
|
-
|
|
62
|
-
`POST /fluent-cart/v2/labels`
|
|
63
|
-
|
|
64
|
-
Create a new label and optionally attach it to an entity (`Order`, `Customer`).
|
|
65
|
-
|
|
66
|
-
#### Permission
|
|
67
|
-
|
|
68
|
-
`labels/manage` | **Request Class:** `LabelRequest`
|
|
69
|
-
|
|
70
|
-
#### Parameters
|
|
71
|
-
|
|
72
|
-
| Parameter | Type | Location | Required | Description |
|
|
73
|
-
|-----------|------|----------|----------|-------------|
|
|
74
|
-
| `value` | string | body | Yes | Label name. Must be unique across `fct_label` table |
|
|
75
|
-
| `bind_to_type` | string | body | No | Model class to attach (e.g. `Order`, `Customer`) |
|
|
76
|
-
| `bind_to_id` | string | body | Conditional | Entity ID (required if `bind_to_type` is provided) |
|
|
77
|
-
|
|
78
|
-
#### Response
|
|
79
|
-
|
|
80
|
-
```json
|
|
81
|
-
{
|
|
82
|
-
"data": {
|
|
83
|
-
"id": 4,
|
|
84
|
-
"value": "Returning Customer"
|
|
85
|
-
},
|
|
86
|
-
"message": "Label created successfully!"
|
|
87
|
-
}
|
|
88
|
-
```
|
|
89
|
-
|
|
90
|
-
#### Example
|
|
91
|
-
|
|
92
|
-
```bash
|
|
93
|
-
curl -X POST "https://example.com/wp-json/fluent-cart/v2/labels" \
|
|
94
|
-
-u "username:app_password" \
|
|
95
|
-
-H "Content-Type: application/json" \
|
|
96
|
-
-d '{
|
|
97
|
-
"value": "Returning Customer",
|
|
98
|
-
"bind_to_type": "Order",
|
|
99
|
-
"bind_to_id": "42"
|
|
100
|
-
}'
|
|
101
|
-
```
|
|
102
|
-
|
|
103
|
-
---
|
|
104
|
-
|
|
105
|
-
### Update Label Selections
|
|
106
|
-
|
|
107
|
-
`POST /fluent-cart/v2/labels/update-label-selections`
|
|
108
|
-
|
|
109
|
-
Sync attached labels for a target entity. Labels in `selectedLabels` are attached; omitted previously attached labels are detached.
|
|
110
|
-
|
|
111
|
-
#### Permission
|
|
112
|
-
|
|
113
|
-
`labels/manage`
|
|
114
|
-
|
|
115
|
-
#### Parameters
|
|
116
|
-
|
|
117
|
-
| Parameter | Type | Location | Required | Description |
|
|
118
|
-
|-----------|------|----------|----------|-------------|
|
|
119
|
-
| `bind_to_type` | string | body | Yes | Target entity model (e.g., `Order`, `Customer`) |
|
|
120
|
-
| `bind_to_id` | string | body | Yes | Target entity ID |
|
|
121
|
-
| `selectedLabels` | array | body | No | Array of label IDs to attach |
|
|
122
|
-
|
|
123
|
-
---
|
|
124
|
-
|
|
125
|
-
## Attribute Groups
|
|
126
|
-
|
|
127
|
-
Attribute groups represent variation categories (e.g., Color, Size, Material).
|
|
128
|
-
|
|
129
|
-
**Prefix:** `/fluent-cart/v2/options/attr` | **Policy:** `ProductPolicy`
|
|
130
|
-
|
|
131
|
-
### List Attribute Groups
|
|
132
|
-
|
|
133
|
-
`GET /fluent-cart/v2/options/attr/groups`
|
|
134
|
-
|
|
135
|
-
#### Permission
|
|
136
|
-
|
|
137
|
-
`products/view`
|
|
138
|
-
|
|
139
|
-
#### Parameters
|
|
140
|
-
|
|
141
|
-
| Parameter | Type | Location | Required | Description |
|
|
142
|
-
|-----------|------|----------|----------|-------------|
|
|
143
|
-
| `search` | object | query | No | Column search criteria (`title`, `slug`) |
|
|
144
|
-
| `filters` | object | query | No | Filter criteria (e.g., `terms_count`) |
|
|
145
|
-
| `with` | array | query | No | Eager load relations (e.g., `["terms"]`) |
|
|
146
|
-
| `order_by` | string | query | No | Sort column (`title`, `id`, `slug`, `created_at`). Default: `title` |
|
|
147
|
-
| `order_type` | string | query | No | Sort direction (`ASC` or `DESC`). Default: `ASC` |
|
|
148
|
-
| `per_page` | integer | query | No | Items per page (default: 10) |
|
|
149
|
-
| `page` | integer | query | No | Page number |
|
|
150
|
-
|
|
151
|
-
#### Response
|
|
152
|
-
|
|
153
|
-
```json
|
|
154
|
-
{
|
|
155
|
-
"groups": {
|
|
156
|
-
"total": 3,
|
|
157
|
-
"per_page": 10,
|
|
158
|
-
"current_page": 1,
|
|
159
|
-
"last_page": 1,
|
|
160
|
-
"data": [
|
|
161
|
-
{
|
|
162
|
-
"id": 1,
|
|
163
|
-
"title": "Color",
|
|
164
|
-
"slug": "color",
|
|
165
|
-
"description": "Product color options",
|
|
166
|
-
"settings": null,
|
|
167
|
-
"created_at": "2025-01-10 08:30:00",
|
|
168
|
-
"updated_at": "2025-01-10 08:30:00",
|
|
169
|
-
"terms_count": 5
|
|
170
|
-
}
|
|
171
|
-
]
|
|
172
|
-
}
|
|
173
|
-
}
|
|
174
|
-
```
|
|
175
|
-
|
|
176
|
-
---
|
|
177
|
-
|
|
178
|
-
### Create Attribute Group
|
|
179
|
-
|
|
180
|
-
`POST /fluent-cart/v2/options/attr/group`
|
|
181
|
-
|
|
182
|
-
#### Permission
|
|
183
|
-
|
|
184
|
-
`products/create` | **Request Class:** `AttrGroupRequest`
|
|
185
|
-
|
|
186
|
-
#### Parameters
|
|
187
|
-
|
|
188
|
-
| Parameter | Type | Location | Required | Description |
|
|
189
|
-
|-----------|------|----------|----------|-------------|
|
|
190
|
-
| `title` | string | body | Yes | Group title (max 50 chars). Must be unique in `fct_atts_groups` |
|
|
191
|
-
| `slug` | string | body | Yes | Group slug (max 50 chars). Must be unique in `fct_atts_groups` |
|
|
192
|
-
| `description` | string | body | No | Group description |
|
|
193
|
-
| `settings` | object | body | No | Additional settings object |
|
|
194
|
-
|
|
195
|
-
---
|
|
196
|
-
|
|
197
|
-
### Get Attribute Group
|
|
198
|
-
|
|
199
|
-
`GET /fluent-cart/v2/options/attr/group/{group_id}`
|
|
200
|
-
|
|
201
|
-
#### Parameters
|
|
202
|
-
|
|
203
|
-
| Parameter | Type | Location | Required | Description |
|
|
204
|
-
|-----------|------|----------|----------|-------------|
|
|
205
|
-
| `group_id` | integer | path | Yes | Attribute Group ID |
|
|
206
|
-
| `with` | array | query | No | Eager load relations (e.g., `["terms"]`) |
|
|
207
|
-
|
|
208
|
-
---
|
|
209
|
-
|
|
210
|
-
### Update Attribute Group
|
|
211
|
-
|
|
212
|
-
`PUT /fluent-cart/v2/options/attr/group/{group_id}`
|
|
213
|
-
|
|
214
|
-
#### Permission
|
|
215
|
-
|
|
216
|
-
`products/edit` | **Request Class:** `AttrGroupRequest`
|
|
217
|
-
|
|
218
|
-
---
|
|
219
|
-
|
|
220
|
-
### Delete Attribute Group
|
|
221
|
-
|
|
222
|
-
`DELETE /fluent-cart/v2/options/attr/group/{group_id}`
|
|
223
|
-
|
|
224
|
-
#### Permission
|
|
225
|
-
|
|
226
|
-
`products/delete`
|
|
227
|
-
|
|
228
|
-
> **Delete Guard:** A group cannot be deleted if any of its terms are currently assigned to product variations. Attempting to delete an active group returns HTTP `403`: `"This group is already in use, can not be deleted."`.
|
|
229
|
-
|
|
230
|
-
---
|
|
231
|
-
|
|
232
|
-
## Attribute Terms
|
|
233
|
-
|
|
234
|
-
Individual variation values within an attribute group (e.g., "Red", "Blue", "Green").
|
|
235
|
-
|
|
236
|
-
**Prefix:** `/fluent-cart/v2/options/attr/group/{group_id}` | **Policy:** `ProductPolicy`
|
|
237
|
-
|
|
238
|
-
### List Attribute Terms
|
|
239
|
-
|
|
240
|
-
`GET /fluent-cart/v2/options/attr/group/{group_id}/terms`
|
|
241
|
-
|
|
242
|
-
#### Parameters
|
|
243
|
-
|
|
244
|
-
| Parameter | Type | Location | Required | Description |
|
|
245
|
-
|-----------|------|----------|----------|-------------|
|
|
246
|
-
| `group_id` | integer | path | Yes | Parent attribute group ID |
|
|
247
|
-
| `search` | object | query | No | Column search (`title`, `slug`) |
|
|
248
|
-
| `order_by` | string | query | No | Sort column (`serial`, `title`, `id`). Default: `serial` |
|
|
249
|
-
| `order_type` | string | query | No | Sort direction (`ASC` or `DESC`). Default: `ASC` |
|
|
250
|
-
| `per_page` | integer | query | No | Items per page (default: 15) |
|
|
251
|
-
|
|
252
|
-
---
|
|
253
|
-
|
|
254
|
-
### Create Attribute Term
|
|
255
|
-
|
|
256
|
-
`POST /fluent-cart/v2/options/attr/group/{group_id}/term`
|
|
257
|
-
|
|
258
|
-
#### Permission
|
|
259
|
-
|
|
260
|
-
`products/create` | **Request Class:** `AttrTermRequest`
|
|
261
|
-
|
|
262
|
-
#### Parameters
|
|
263
|
-
|
|
264
|
-
| Parameter | Type | Location | Required | Description |
|
|
265
|
-
|-----------|------|----------|----------|-------------|
|
|
266
|
-
| `group_id` | integer | path | Yes | Parent attribute group ID |
|
|
267
|
-
| `title` | string | body | Yes | Term title (max 50 chars). Must be unique in `fct_atts_terms` |
|
|
268
|
-
| `slug` | string | body | Yes | Term slug (max 50 chars). Must be unique in `fct_atts_terms` |
|
|
269
|
-
| `description` | string | body | No | Term description |
|
|
270
|
-
| `serial` | integer | body | No | Sort order index (default: `10`) |
|
|
271
|
-
|
|
272
|
-
---
|
|
273
|
-
|
|
274
|
-
### Update Attribute Term
|
|
275
|
-
|
|
276
|
-
`POST /fluent-cart/v2/options/attr/group/{group_id}/term/{term_id}`
|
|
277
|
-
|
|
278
|
-
#### Permission
|
|
279
|
-
|
|
280
|
-
`products/edit` | **Request Class:** `AttrTermRequest`
|
|
281
|
-
|
|
282
|
-
---
|
|
283
|
-
|
|
284
|
-
### Delete Attribute Term
|
|
285
|
-
|
|
286
|
-
`DELETE /fluent-cart/v2/options/attr/group/{group_id}/term/{term_id}`
|
|
287
|
-
|
|
288
|
-
#### Permission
|
|
289
|
-
|
|
290
|
-
`products/delete`
|
|
291
|
-
|
|
292
|
-
> **Delete Guard:** Terms assigned to product variations return HTTP `403`: `"This term is already in use, can not be deleted."`.
|
|
293
|
-
|
|
294
|
-
---
|
|
295
|
-
|
|
296
|
-
### Change Term Sort Order (Serial Shift)
|
|
297
|
-
|
|
298
|
-
`POST /fluent-cart/v2/options/attr/group/{group_id}/term/{term_id}/serial`
|
|
299
|
-
|
|
300
|
-
Increments or decrements the sort order `serial` value of a term.
|
|
301
|
-
|
|
302
|
-
#### Permission
|
|
303
|
-
|
|
304
|
-
`products/edit`
|
|
305
|
-
|
|
306
|
-
#### Parameters
|
|
307
|
-
|
|
308
|
-
| Parameter | Type | Location | Required | Description |
|
|
309
|
-
|-----------|------|----------|----------|-------------|
|
|
310
|
-
| `group_id` | integer | path | Yes | Attribute group ID |
|
|
311
|
-
| `term_id` | integer | path | Yes | Term ID to reorder |
|
|
312
|
-
| `direction` | string | body | No | `up` (decrements serial, min 0) or `down` (increments serial). Default: `up` |
|
|
313
|
-
|
|
314
|
-
#### Response
|
|
315
|
-
|
|
316
|
-
```json
|
|
317
|
-
{
|
|
318
|
-
"data": 2,
|
|
319
|
-
"message": "Serial updated."
|
|
320
|
-
}
|
|
321
|
-
```
|
|
1
|
+
# Labels & Attributes API
|
|
2
|
+
|
|
3
|
+
Manage organizational labels for orders and customers, and product attribute groups and terms used for variation options in FluentCart.
|
|
4
|
+
|
|
5
|
+
**Base URL:** `https://your-site.com/wp-json/fluent-cart/v2`
|
|
6
|
+
**Policies:** `LabelPolicy` (Labels) / `ProductPolicy` (Attributes)
|
|
7
|
+
|
|
8
|
+
---
|
|
9
|
+
|
|
10
|
+
## Endpoints Overview
|
|
11
|
+
|
|
12
|
+
| Group | Method | Endpoint | Permission / Policy | Request Class | Description |
|
|
13
|
+
|-------|--------|----------|--------------------|---------------|-------------|
|
|
14
|
+
| **Labels** | GET | `/labels` | `labels/view` | — | Retrieve all labels |
|
|
15
|
+
| | POST | `/labels` | `labels/manage` | `LabelRequest` | Create label and optionally bind to entity |
|
|
16
|
+
| | POST | `/labels/update-label-selections` | `labels/manage` | — | Sync label selection for order/customer |
|
|
17
|
+
| **Attribute Groups** | GET | `/options/attr/groups` | `products/view` | — | List attribute groups (Color, Size, etc.) |
|
|
18
|
+
| | POST | `/options/attr/group` | `products/create` | `AttrGroupRequest` | Create attribute group |
|
|
19
|
+
| | GET | `/options/attr/group/{group_id}` | `products/view` | — | Get single attribute group (with terms) |
|
|
20
|
+
| | PUT | `/options/attr/group/{group_id}` | `products/edit` | `AttrGroupRequest` | Update attribute group |
|
|
21
|
+
| | DELETE | `/options/attr/group/{group_id}` | `products/delete` | — | Delete attribute group (guarded if in use) |
|
|
22
|
+
| **Attribute Terms** | GET | `/options/attr/group/{id}/terms` | `products/view` | — | List terms within attribute group |
|
|
23
|
+
| | POST | `/options/attr/group/{id}/term` | `products/create` | `AttrTermRequest` | Create term within attribute group |
|
|
24
|
+
| | POST | `/options/attr/group/{id}/term/{term_id}` | `products/edit` | `AttrTermRequest` | Update attribute term |
|
|
25
|
+
| | DELETE | `/options/attr/group/{id}/term/{term_id}` | `products/delete` | — | Delete attribute term (guarded if in use) |
|
|
26
|
+
| | POST | `/options/attr/group/{id}/term/{term_id}/serial` | `products/edit` | — | Shift term position (`up` or `down`) |
|
|
27
|
+
|
|
28
|
+
---
|
|
29
|
+
|
|
30
|
+
## Labels
|
|
31
|
+
|
|
32
|
+
Labels are tags that attach to orders, customers, or other entities via a polymorphic relationship for organizational filtering.
|
|
33
|
+
|
|
34
|
+
**Prefix:** `/fluent-cart/v2/labels` | **Policy:** `LabelPolicy`
|
|
35
|
+
|
|
36
|
+
### List Labels
|
|
37
|
+
|
|
38
|
+
`GET /fluent-cart/v2/labels`
|
|
39
|
+
|
|
40
|
+
#### Permission
|
|
41
|
+
|
|
42
|
+
`labels/view`
|
|
43
|
+
|
|
44
|
+
#### Response
|
|
45
|
+
|
|
46
|
+
```json
|
|
47
|
+
{
|
|
48
|
+
"labels": {
|
|
49
|
+
"labels": [
|
|
50
|
+
{ "id": 1, "value": "VIP" },
|
|
51
|
+
{ "id": 2, "value": "Wholesale" },
|
|
52
|
+
{ "id": 3, "value": "Priority" }
|
|
53
|
+
]
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
---
|
|
59
|
+
|
|
60
|
+
### Create Label
|
|
61
|
+
|
|
62
|
+
`POST /fluent-cart/v2/labels`
|
|
63
|
+
|
|
64
|
+
Create a new label and optionally attach it to an entity (`Order`, `Customer`).
|
|
65
|
+
|
|
66
|
+
#### Permission
|
|
67
|
+
|
|
68
|
+
`labels/manage` | **Request Class:** `LabelRequest`
|
|
69
|
+
|
|
70
|
+
#### Parameters
|
|
71
|
+
|
|
72
|
+
| Parameter | Type | Location | Required | Description |
|
|
73
|
+
|-----------|------|----------|----------|-------------|
|
|
74
|
+
| `value` | string | body | Yes | Label name. Must be unique across `fct_label` table |
|
|
75
|
+
| `bind_to_type` | string | body | No | Model class to attach (e.g. `Order`, `Customer`) |
|
|
76
|
+
| `bind_to_id` | string | body | Conditional | Entity ID (required if `bind_to_type` is provided) |
|
|
77
|
+
|
|
78
|
+
#### Response
|
|
79
|
+
|
|
80
|
+
```json
|
|
81
|
+
{
|
|
82
|
+
"data": {
|
|
83
|
+
"id": 4,
|
|
84
|
+
"value": "Returning Customer"
|
|
85
|
+
},
|
|
86
|
+
"message": "Label created successfully!"
|
|
87
|
+
}
|
|
88
|
+
```
|
|
89
|
+
|
|
90
|
+
#### Example
|
|
91
|
+
|
|
92
|
+
```bash
|
|
93
|
+
curl -X POST "https://example.com/wp-json/fluent-cart/v2/labels" \
|
|
94
|
+
-u "username:app_password" \
|
|
95
|
+
-H "Content-Type: application/json" \
|
|
96
|
+
-d '{
|
|
97
|
+
"value": "Returning Customer",
|
|
98
|
+
"bind_to_type": "Order",
|
|
99
|
+
"bind_to_id": "42"
|
|
100
|
+
}'
|
|
101
|
+
```
|
|
102
|
+
|
|
103
|
+
---
|
|
104
|
+
|
|
105
|
+
### Update Label Selections
|
|
106
|
+
|
|
107
|
+
`POST /fluent-cart/v2/labels/update-label-selections`
|
|
108
|
+
|
|
109
|
+
Sync attached labels for a target entity. Labels in `selectedLabels` are attached; omitted previously attached labels are detached.
|
|
110
|
+
|
|
111
|
+
#### Permission
|
|
112
|
+
|
|
113
|
+
`labels/manage`
|
|
114
|
+
|
|
115
|
+
#### Parameters
|
|
116
|
+
|
|
117
|
+
| Parameter | Type | Location | Required | Description |
|
|
118
|
+
|-----------|------|----------|----------|-------------|
|
|
119
|
+
| `bind_to_type` | string | body | Yes | Target entity model (e.g., `Order`, `Customer`) |
|
|
120
|
+
| `bind_to_id` | string | body | Yes | Target entity ID |
|
|
121
|
+
| `selectedLabels` | array | body | No | Array of label IDs to attach |
|
|
122
|
+
|
|
123
|
+
---
|
|
124
|
+
|
|
125
|
+
## Attribute Groups
|
|
126
|
+
|
|
127
|
+
Attribute groups represent variation categories (e.g., Color, Size, Material).
|
|
128
|
+
|
|
129
|
+
**Prefix:** `/fluent-cart/v2/options/attr` | **Policy:** `ProductPolicy`
|
|
130
|
+
|
|
131
|
+
### List Attribute Groups
|
|
132
|
+
|
|
133
|
+
`GET /fluent-cart/v2/options/attr/groups`
|
|
134
|
+
|
|
135
|
+
#### Permission
|
|
136
|
+
|
|
137
|
+
`products/view`
|
|
138
|
+
|
|
139
|
+
#### Parameters
|
|
140
|
+
|
|
141
|
+
| Parameter | Type | Location | Required | Description |
|
|
142
|
+
|-----------|------|----------|----------|-------------|
|
|
143
|
+
| `search` | object | query | No | Column search criteria (`title`, `slug`) |
|
|
144
|
+
| `filters` | object | query | No | Filter criteria (e.g., `terms_count`) |
|
|
145
|
+
| `with` | array | query | No | Eager load relations (e.g., `["terms"]`) |
|
|
146
|
+
| `order_by` | string | query | No | Sort column (`title`, `id`, `slug`, `created_at`). Default: `title` |
|
|
147
|
+
| `order_type` | string | query | No | Sort direction (`ASC` or `DESC`). Default: `ASC` |
|
|
148
|
+
| `per_page` | integer | query | No | Items per page (default: 10) |
|
|
149
|
+
| `page` | integer | query | No | Page number |
|
|
150
|
+
|
|
151
|
+
#### Response
|
|
152
|
+
|
|
153
|
+
```json
|
|
154
|
+
{
|
|
155
|
+
"groups": {
|
|
156
|
+
"total": 3,
|
|
157
|
+
"per_page": 10,
|
|
158
|
+
"current_page": 1,
|
|
159
|
+
"last_page": 1,
|
|
160
|
+
"data": [
|
|
161
|
+
{
|
|
162
|
+
"id": 1,
|
|
163
|
+
"title": "Color",
|
|
164
|
+
"slug": "color",
|
|
165
|
+
"description": "Product color options",
|
|
166
|
+
"settings": null,
|
|
167
|
+
"created_at": "2025-01-10 08:30:00",
|
|
168
|
+
"updated_at": "2025-01-10 08:30:00",
|
|
169
|
+
"terms_count": 5
|
|
170
|
+
}
|
|
171
|
+
]
|
|
172
|
+
}
|
|
173
|
+
}
|
|
174
|
+
```
|
|
175
|
+
|
|
176
|
+
---
|
|
177
|
+
|
|
178
|
+
### Create Attribute Group
|
|
179
|
+
|
|
180
|
+
`POST /fluent-cart/v2/options/attr/group`
|
|
181
|
+
|
|
182
|
+
#### Permission
|
|
183
|
+
|
|
184
|
+
`products/create` | **Request Class:** `AttrGroupRequest`
|
|
185
|
+
|
|
186
|
+
#### Parameters
|
|
187
|
+
|
|
188
|
+
| Parameter | Type | Location | Required | Description |
|
|
189
|
+
|-----------|------|----------|----------|-------------|
|
|
190
|
+
| `title` | string | body | Yes | Group title (max 50 chars). Must be unique in `fct_atts_groups` |
|
|
191
|
+
| `slug` | string | body | Yes | Group slug (max 50 chars). Must be unique in `fct_atts_groups` |
|
|
192
|
+
| `description` | string | body | No | Group description |
|
|
193
|
+
| `settings` | object | body | No | Additional settings object |
|
|
194
|
+
|
|
195
|
+
---
|
|
196
|
+
|
|
197
|
+
### Get Attribute Group
|
|
198
|
+
|
|
199
|
+
`GET /fluent-cart/v2/options/attr/group/{group_id}`
|
|
200
|
+
|
|
201
|
+
#### Parameters
|
|
202
|
+
|
|
203
|
+
| Parameter | Type | Location | Required | Description |
|
|
204
|
+
|-----------|------|----------|----------|-------------|
|
|
205
|
+
| `group_id` | integer | path | Yes | Attribute Group ID |
|
|
206
|
+
| `with` | array | query | No | Eager load relations (e.g., `["terms"]`) |
|
|
207
|
+
|
|
208
|
+
---
|
|
209
|
+
|
|
210
|
+
### Update Attribute Group
|
|
211
|
+
|
|
212
|
+
`PUT /fluent-cart/v2/options/attr/group/{group_id}`
|
|
213
|
+
|
|
214
|
+
#### Permission
|
|
215
|
+
|
|
216
|
+
`products/edit` | **Request Class:** `AttrGroupRequest`
|
|
217
|
+
|
|
218
|
+
---
|
|
219
|
+
|
|
220
|
+
### Delete Attribute Group
|
|
221
|
+
|
|
222
|
+
`DELETE /fluent-cart/v2/options/attr/group/{group_id}`
|
|
223
|
+
|
|
224
|
+
#### Permission
|
|
225
|
+
|
|
226
|
+
`products/delete`
|
|
227
|
+
|
|
228
|
+
> **Delete Guard:** A group cannot be deleted if any of its terms are currently assigned to product variations. Attempting to delete an active group returns HTTP `403`: `"This group is already in use, can not be deleted."`.
|
|
229
|
+
|
|
230
|
+
---
|
|
231
|
+
|
|
232
|
+
## Attribute Terms
|
|
233
|
+
|
|
234
|
+
Individual variation values within an attribute group (e.g., "Red", "Blue", "Green").
|
|
235
|
+
|
|
236
|
+
**Prefix:** `/fluent-cart/v2/options/attr/group/{group_id}` | **Policy:** `ProductPolicy`
|
|
237
|
+
|
|
238
|
+
### List Attribute Terms
|
|
239
|
+
|
|
240
|
+
`GET /fluent-cart/v2/options/attr/group/{group_id}/terms`
|
|
241
|
+
|
|
242
|
+
#### Parameters
|
|
243
|
+
|
|
244
|
+
| Parameter | Type | Location | Required | Description |
|
|
245
|
+
|-----------|------|----------|----------|-------------|
|
|
246
|
+
| `group_id` | integer | path | Yes | Parent attribute group ID |
|
|
247
|
+
| `search` | object | query | No | Column search (`title`, `slug`) |
|
|
248
|
+
| `order_by` | string | query | No | Sort column (`serial`, `title`, `id`). Default: `serial` |
|
|
249
|
+
| `order_type` | string | query | No | Sort direction (`ASC` or `DESC`). Default: `ASC` |
|
|
250
|
+
| `per_page` | integer | query | No | Items per page (default: 15) |
|
|
251
|
+
|
|
252
|
+
---
|
|
253
|
+
|
|
254
|
+
### Create Attribute Term
|
|
255
|
+
|
|
256
|
+
`POST /fluent-cart/v2/options/attr/group/{group_id}/term`
|
|
257
|
+
|
|
258
|
+
#### Permission
|
|
259
|
+
|
|
260
|
+
`products/create` | **Request Class:** `AttrTermRequest`
|
|
261
|
+
|
|
262
|
+
#### Parameters
|
|
263
|
+
|
|
264
|
+
| Parameter | Type | Location | Required | Description |
|
|
265
|
+
|-----------|------|----------|----------|-------------|
|
|
266
|
+
| `group_id` | integer | path | Yes | Parent attribute group ID |
|
|
267
|
+
| `title` | string | body | Yes | Term title (max 50 chars). Must be unique in `fct_atts_terms` |
|
|
268
|
+
| `slug` | string | body | Yes | Term slug (max 50 chars). Must be unique in `fct_atts_terms` |
|
|
269
|
+
| `description` | string | body | No | Term description |
|
|
270
|
+
| `serial` | integer | body | No | Sort order index (default: `10`) |
|
|
271
|
+
|
|
272
|
+
---
|
|
273
|
+
|
|
274
|
+
### Update Attribute Term
|
|
275
|
+
|
|
276
|
+
`POST /fluent-cart/v2/options/attr/group/{group_id}/term/{term_id}`
|
|
277
|
+
|
|
278
|
+
#### Permission
|
|
279
|
+
|
|
280
|
+
`products/edit` | **Request Class:** `AttrTermRequest`
|
|
281
|
+
|
|
282
|
+
---
|
|
283
|
+
|
|
284
|
+
### Delete Attribute Term
|
|
285
|
+
|
|
286
|
+
`DELETE /fluent-cart/v2/options/attr/group/{group_id}/term/{term_id}`
|
|
287
|
+
|
|
288
|
+
#### Permission
|
|
289
|
+
|
|
290
|
+
`products/delete`
|
|
291
|
+
|
|
292
|
+
> **Delete Guard:** Terms assigned to product variations return HTTP `403`: `"This term is already in use, can not be deleted."`.
|
|
293
|
+
|
|
294
|
+
---
|
|
295
|
+
|
|
296
|
+
### Change Term Sort Order (Serial Shift)
|
|
297
|
+
|
|
298
|
+
`POST /fluent-cart/v2/options/attr/group/{group_id}/term/{term_id}/serial`
|
|
299
|
+
|
|
300
|
+
Increments or decrements the sort order `serial` value of a term.
|
|
301
|
+
|
|
302
|
+
#### Permission
|
|
303
|
+
|
|
304
|
+
`products/edit`
|
|
305
|
+
|
|
306
|
+
#### Parameters
|
|
307
|
+
|
|
308
|
+
| Parameter | Type | Location | Required | Description |
|
|
309
|
+
|-----------|------|----------|----------|-------------|
|
|
310
|
+
| `group_id` | integer | path | Yes | Attribute group ID |
|
|
311
|
+
| `term_id` | integer | path | Yes | Term ID to reorder |
|
|
312
|
+
| `direction` | string | body | No | `up` (decrements serial, min 0) or `down` (increments serial). Default: `up` |
|
|
313
|
+
|
|
314
|
+
#### Response
|
|
315
|
+
|
|
316
|
+
```json
|
|
317
|
+
{
|
|
318
|
+
"data": 2,
|
|
319
|
+
"message": "Serial updated."
|
|
320
|
+
}
|
|
321
|
+
```
|