fluentcart-developer 2.3.0 → 2.3.2

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.
Files changed (49) hide show
  1. package/README.md +59 -59
  2. package/dist/cards/fluentcart/tools.d.ts.map +1 -1
  3. package/dist/cards/fluentcart/tools.js +160 -12
  4. package/dist/cards/fluentcart/tools.js.map +1 -1
  5. package/dist/skills/fluentcart-developer/.claude-plugin/plugin.json +12 -12
  6. package/dist/skills/fluentcart-developer/.mcp.json +11 -11
  7. package/dist/skills/fluentcart-developer/examples/fluentcart-starter-child-theme/fluent-cart/checkout.php +32 -32
  8. package/dist/skills/fluentcart-developer/examples/fluentcart-starter-child-theme/functions.php +40 -40
  9. package/dist/skills/fluentcart-developer/examples/sample-fee-surcharge-plugin/fluentcart-fee-surcharge.php +38 -38
  10. package/dist/skills/fluentcart-developer/references/action-hooks-cart-checkout.md +1355 -1355
  11. package/dist/skills/fluentcart-developer/references/action-hooks-customers-users.md +266 -266
  12. package/dist/skills/fluentcart-developer/references/action-hooks-licenses.md +855 -855
  13. package/dist/skills/fluentcart-developer/references/action-hooks-orders.md +631 -631
  14. package/dist/skills/fluentcart-developer/references/action-hooks-payments-integrations.md +963 -963
  15. package/dist/skills/fluentcart-developer/references/action-hooks-products-coupons.md +585 -585
  16. package/dist/skills/fluentcart-developer/references/action-hooks-subscriptions.md +661 -661
  17. package/dist/skills/fluentcart-developer/references/database-models-query-builder.md +194 -194
  18. package/dist/skills/fluentcart-developer/references/database-models-reference.md +604 -604
  19. package/dist/skills/fluentcart-developer/references/engineering-notes.md +154 -154
  20. package/dist/skills/fluentcart-developer/references/fee-system-guide.md +449 -449
  21. package/dist/skills/fluentcart-developer/references/filter-hooks-cart-checkout.md +1202 -1202
  22. package/dist/skills/fluentcart-developer/references/filter-hooks-integrations-advanced.md +1598 -1598
  23. package/dist/skills/fluentcart-developer/references/filter-hooks-products-pricing.md +628 -628
  24. package/dist/skills/fluentcart-developer/references/filter-hooks-settings-configuration.md +1177 -1177
  25. package/dist/skills/fluentcart-developer/references/fluentcart-developer-guide.md +154 -154
  26. package/dist/skills/fluentcart-developer/references/ghost-product-selling.md +458 -458
  27. package/dist/skills/fluentcart-developer/references/modules-and-extensions-reference.md +224 -224
  28. package/dist/skills/fluentcart-developer/references/payment-gateway-integration.md +761 -761
  29. package/dist/skills/fluentcart-developer/references/rest-api-customer-profile.md +190 -190
  30. package/dist/skills/fluentcart-developer/references/rest-api-customers.md +1121 -1121
  31. package/dist/skills/fluentcart-developer/references/rest-api-dashboard-utilities.md +219 -219
  32. package/dist/skills/fluentcart-developer/references/rest-api-email-notifications.md +619 -619
  33. package/dist/skills/fluentcart-developer/references/rest-api-files.md +290 -290
  34. package/dist/skills/fluentcart-developer/references/rest-api-integrations.md +324 -324
  35. package/dist/skills/fluentcart-developer/references/rest-api-labels-attributes.md +321 -321
  36. package/dist/skills/fluentcart-developer/references/rest-api-order-bumps.md +200 -200
  37. package/dist/skills/fluentcart-developer/references/rest-api-overview.md +131 -131
  38. package/dist/skills/fluentcart-developer/references/rest-api-public-shop.md +172 -172
  39. package/dist/skills/fluentcart-developer/references/rest-api-reference.md +552 -552
  40. package/dist/skills/fluentcart-developer/references/rest-api-reports.md +377 -377
  41. package/dist/skills/fluentcart-developer/references/rest-api-roles-permissions.md +147 -147
  42. package/dist/skills/fluentcart-developer/references/rest-api-settings.md +528 -528
  43. package/dist/skills/fluentcart-developer/references/rest-api-shipping.md +799 -799
  44. package/dist/skills/fluentcart-developer/references/rest-api-tax.md +356 -356
  45. package/dist/skills/fluentcart-developer/references/subscription-customization.md +197 -197
  46. package/dist/skills/fluentcart-developer/scripts/cli.js +1 -1
  47. package/dist/version.d.ts +1 -1
  48. package/dist/version.js +1 -1
  49. package/package.json +65 -65
@@ -1,855 +1,855 @@
1
- # Action Hooks: Licenses (Pro)
2
-
3
- Action hooks for software licensing lifecycle management including License status changes, `LicenseActivation` management, `LicenseSite` activations/deactivations, and bulk operations. All hooks in this section require the FluentCart Pro plugin.
4
-
5
- ---
6
-
7
- ## License Status
8
-
9
- ### `license_status_updated` (Pro)
10
- `fluent_cart_sl/license_status_updated` — Fires on any license status change
11
-
12
- * **When it runs:** This action fires whenever a License's status transitions from one value to another (e.g., `active` to `expired`, `active` to `disabled`, etc.).
13
- * **Source:** `fluent-cart-pro/app/Modules/Licensing/Models/License.php` (line 206)
14
-
15
- #### Parameters:
16
- `$data` *(array)*: License status change data
17
- * `license` *(\FluentCart\App\Models\License)* — The license model after the status change
18
- * `old_status` *(string)* — The previous status value
19
- * `new_status` *(string)* — The new status value
20
-
21
- #### Usage Example:
22
- ```php
23
- // Hook into any license status update
24
- add_action('fluent_cart_sl/license_status_updated', function ($data) {
25
- // Extract license model and status transition strings
26
- $license = $data['license'];
27
- $oldStatus = $oldStatus = $data['old_status'];
28
- $newStatus = $data['new_status'];
29
-
30
- // Log status change to system log
31
- fluent_cart_add_log(
32
- 'License Status Changed',
33
- sprintf('License #%d changed from %s to %s', $license->id, $oldStatus, $newStatus),
34
- 'info'
35
- );
36
- }, 10, 1);
37
- ```
38
-
39
- ---
40
-
41
- ### `license_status_updated_to_{$newStatus}` (Pro)
42
- `fluent_cart_sl/license_status_updated_to_{$newStatus}` — Fires when a license transitions to a specific status
43
-
44
- * **When it runs:** This is a dynamic hook that fires for a specific target status. For example, `fluent_cart_sl/license_status_updated_to_expired` fires only when a License becomes expired.
45
- * **Source:** `fluent-cart-pro/app/Modules/Licensing/Models/License.php` (line 211)
46
-
47
- #### Parameters:
48
- `$data` *(array)*: License status change data
49
- * `license` *(\FluentCart\App\Models\License)* — The license model after the status change
50
- * `old_status` *(string)* — The previous status value
51
- * `new_status` *(string)* — The new status value
52
-
53
- #### Usage Example:
54
- ```php
55
- // Hook when a license transitions to expired status
56
- add_action('fluent_cart_sl/license_status_updated_to_expired', function ($data) {
57
- // Extract license model and status values
58
- $license = $data['license'];
59
- $oldStatus = $data['old_status'];
60
- $newStatus = $data['new_status'];
61
-
62
- // Handle license expiration notification via email
63
- wp_mail(get_option('admin_email'), 'License Expired', sprintf('License #%d has expired.', $license->id));
64
- }, 10, 1);
65
- ```
66
-
67
- ---
68
-
69
- ## License Activation Status
70
-
71
- ### `license_activation_status_updated` (Pro)
72
- `fluent_cart_sl/license_activation_status_updated` — Fires on any license activation status change
73
-
74
- * **When it runs:** This action fires whenever a `LicenseActivation`'s status transitions from one value to another.
75
- * **Source:** `fluent-cart-pro/app/Modules/Licensing/Models/LicenseActivation.php` (line 52)
76
-
77
- #### Parameters:
78
- `$data` *(array)*: License activation status change data
79
- * `license` *(\FluentCart\App\Models\LicenseActivation)* — The license activation model (note: key is `license` but value is a `LicenseActivation` instance)
80
- * `old_status` *(string)* — The previous activation status
81
- * `new_status` *(string)* — The new activation status
82
-
83
- #### Usage Example:
84
- ```php
85
- // Hook into any license activation status change
86
- add_action('fluent_cart_sl/license_activation_status_updated', function ($data) {
87
- // Extract activation instance and status strings
88
- $activation = $data['license']; // Note: key is 'license' but value is a LicenseActivation instance
89
- $oldStatus = $data['old_status'];
90
- $newStatus = $data['new_status'];
91
-
92
- // Log activation status transition
93
- fluent_cart_add_log(
94
- 'License Activation Status Changed',
95
- sprintf('Activation #%d status changed from %s to %s', $activation->id, $oldStatus, $newStatus),
96
- 'info'
97
- );
98
- }, 10, 1);
99
- ```
100
-
101
- ---
102
-
103
- ### `license_activation_status_updated_to_{$newStatus}` (Pro)
104
- `fluent_cart_sl/license_activation_status_updated_to_{$newStatus}` — Fires when a license activation transitions to a specific status
105
-
106
- * **When it runs:** This is a dynamic hook that fires for a specific target `LicenseActivation` status.
107
- * **Source:** `fluent-cart-pro/app/Modules/Licensing/Models/LicenseActivation.php` (line 57)
108
-
109
- #### Parameters:
110
- `$data` *(array)*: License activation status change data
111
- * `license` *(\FluentCart\App\Models\LicenseActivation)* — The license activation model (note: key is `license` but value is a `LicenseActivation` instance)
112
- * `old_status` *(string)* — The previous activation status
113
- * `new_status` *(string)* — The new activation status
114
-
115
- #### Usage Example:
116
- ```php
117
- // Hook when a license activation becomes active
118
- add_action('fluent_cart_sl/license_activation_status_updated_to_active', function ($data) {
119
- // Extract activation model instance
120
- $activation = $data['license']; // Note: key is 'license' but value is a LicenseActivation instance
121
- $oldStatus = $data['old_status'];
122
- $newStatus = $data['new_status'];
123
-
124
- // Handle activation becoming active
125
- }, 10, 1);
126
- ```
127
-
128
- ---
129
-
130
- ## License Limits
131
-
132
- ### `license_limit_increased` (activation count) (Pro)
133
- `fluent_cart_sl/license_limit_increased` — Fires when the license activation count is increased
134
-
135
- * **When it runs:** This action fires when a License's activation count is increased.
136
- * **Source:** `fluent-cart-pro/app/Modules/Licensing/Models/License.php` (line 224)
137
-
138
- #### Parameters:
139
- `$data` *(array)*: License limit change data
140
- * `license` *(\FluentCart\App\Models\License)* — The license model
141
- * `old_count` *(int)* — The previous activation count
142
-
143
- #### Usage Example:
144
- ```php
145
- // Hook when the license activation count is increased
146
- add_action('fluent_cart_sl/license_limit_increased', function ($data) {
147
- // Extract license model and previous activation count
148
- $license = $data['license'];
149
- $oldCount = $data['old_count'];
150
-
151
- // Log activation count increase
152
- fluent_cart_add_log(
153
- 'License Activation Count Increased',
154
- sprintf('License #%d activation count increased from %d', $license->id, $oldCount),
155
- 'info'
156
- );
157
- }, 10, 1);
158
- ```
159
-
160
- ---
161
-
162
- ### `license_limit_decreased` (Pro)
163
- `fluent_cart_sl/license_limit_decreased` — Fires when the license activation count is decreased
164
-
165
- * **When it runs:** This action fires when a License's activation count is decreased.
166
- * **Source:** `fluent-cart-pro/app/Modules/Licensing/Models/License.php` (line 239)
167
-
168
- #### Parameters:
169
- `$data` *(array)*: License limit change data
170
- * `license` *(\FluentCart\App\Models\License)* — The license model
171
- * `old_count` *(int)* — The previous activation count
172
-
173
- #### Usage Example:
174
- ```php
175
- // Hook when the license activation count is decreased
176
- add_action('fluent_cart_sl/license_limit_decreased', function ($data) {
177
- // Extract license model and previous activation count
178
- $license = $data['license'];
179
- $oldCount = $data['old_count'];
180
-
181
- // Log activation count decrease
182
- fluent_cart_add_log(
183
- 'License Activation Count Decreased',
184
- sprintf('License #%d activation count decreased from %d', $license->id, $oldCount),
185
- 'info'
186
- );
187
- }, 10, 1);
188
- ```
189
-
190
- ---
191
-
192
- ### `license_limit_increased` (limit slots) (Pro)
193
- `fluent_cart_sl/license_limit_increased` — Fires when the license activation limit (slots) is increased
194
-
195
- * **When it runs:** This action fires when a License's activation limit (maximum allowed activations) is increased.
196
- * **Source:** `fluent-cart-pro/app/Modules/Licensing/Models/License.php` (line 259)
197
-
198
- #### Parameters:
199
- `$data` *(array)*: License limit change data
200
- * `license` *(\FluentCart\App\Models\License)* — The license model
201
- * `old_count` *(int)* — The previous activation limit
202
-
203
- #### Usage Example:
204
- ```php
205
- // Hook when the license activation limit (slots) is increased
206
- add_action('fluent_cart_sl/license_limit_increased', function ($data) {
207
- // Extract license model and previous limit count
208
- $license = $data['license'];
209
- $oldCount = $data['old_count'];
210
-
211
- // Log activation limit increase
212
- fluent_cart_add_log(
213
- 'License Limit Increased',
214
- sprintf('License #%d activation limit increased from %d', $license->id, $oldCount),
215
- 'info'
216
- );
217
- }, 10, 1);
218
- ```
219
-
220
- ---
221
-
222
- ## License Key & Validity
223
-
224
- ### `license_key_regenerated` (Pro)
225
- `fluent_cart_sl/license_key_regenerated` — Fires when a license key is regenerated
226
-
227
- * **When it runs:** This action fires when a license key is regenerated, replacing the old key with a new one.
228
- * **Source:** `fluent-cart-pro/app/Modules/Licensing/Models/License.php` (line 318)
229
-
230
- #### Parameters:
231
- `$data` *(array)*: License key change data
232
- * `license` *(\FluentCart\App\Models\License)* — The license model with the new key
233
- * `old_key` *(string)* — The previous license key
234
-
235
- #### Usage Example:
236
- ```php
237
- // Hook when a license key is regenerated
238
- add_action('fluent_cart_sl/license_key_regenerated', function ($data) {
239
- // Extract license model and previous key string
240
- $license = $data['license'];
241
- $oldKey = $data['old_key'];
242
-
243
- // Log license key regeneration event
244
- fluent_cart_add_log(
245
- 'License Key Regenerated',
246
- sprintf('License #%d key was regenerated', $license->id),
247
- 'info'
248
- );
249
- }, 10, 1);
250
- ```
251
-
252
- ---
253
-
254
- ### `license_validity_extended` (Pro)
255
- `fluent_cart_sl/license_validity_extended` — Fires when a license expiration date is changed
256
-
257
- * **When it runs:** This action fires when a license's expiration date is modified to a new date.
258
- * **Source:** `fluent-cart-pro/app/Modules/Licensing/Models/License.php` (line 348)
259
-
260
- #### Parameters:
261
- `$data` *(array)*: License validity change data
262
- * `license` *(\FluentCart\App\Models\License)* — The license model
263
- * `old_date` *(string)* — The previous expiration date
264
- * `new_date` *(string)* — The new expiration date
265
-
266
- #### Usage Example:
267
- ```php
268
- // Hook when a license expiration date is modified
269
- add_action('fluent_cart_sl/license_validity_extended', function ($data) {
270
- // Extract license model and expiration dates
271
- $license = $data['license'];
272
- $oldDate = $data['old_date'];
273
- $newDate = $data['new_date'];
274
-
275
- // Log license expiration change
276
- fluent_cart_add_log(
277
- 'License Validity Extended',
278
- sprintf('License #%d expiration changed from %s to %s', $license->id, $oldDate, $newDate),
279
- 'info'
280
- );
281
- }, 10, 1);
282
- ```
283
-
284
- ---
285
-
286
- ## License Lifecycle
287
-
288
- ### `license_issued` (order) (Pro)
289
- `fluent_cart/licensing/license_issued` — Fires when a new license is created for an order
290
-
291
- * **When it runs:** This action fires when a new license is generated as part of an order fulfillment process.
292
- * **Source:** `fluent-cart-pro/app/Modules/Licensing/Hooks/Handlers/LicenseGenerationHandler.php` (line 532)
293
-
294
- #### Parameters:
295
- `$data` *(array)*: License issuance data
296
- * `license` *(\FluentCart\App\Models\License)* — The newly created license
297
- * `data` *(array)* — License creation data
298
- * `order` *(\FluentCart\App\Models\Order)* — The associated order
299
- * `subscription` *(\FluentCart\App\Models\Subscription|null)* — The associated subscription, if any
300
-
301
- #### Usage Example:
302
- ```php
303
- // Hook when a new license is created for an order
304
- add_action('fluent_cart/licensing/license_issued', function ($data) {
305
- // Extract license, order, and subscription models
306
- $license = $data['license'];
307
- $order = $data['order'];
308
- $subscription = $data['subscription'];
309
-
310
- // Notify customer about their new license via email
311
- wp_mail(
312
- $order->customer->email,
313
- 'Your License Key',
314
- sprintf('Your license key for order #%d is: %s', $order->id, $license->license_key)
315
- );
316
- }, 10, 1);
317
- ```
318
-
319
- ---
320
-
321
- ### `license_issued` (manager) (Pro)
322
- `fluent_cart_sl/license_issued` — Fires when a license is issued via the license manager
323
-
324
- * **When it runs:** This action fires when a license is created through the admin license management interface.
325
- * **Source:** `fluent-cart-pro/app/Modules/Licensing/Services/LicenseManager.php` (line 261)
326
-
327
- #### Parameters:
328
- `$data` *(array)*: License issuance data
329
- * `license` *(\FluentCart\App\Models\License)* — The newly created license
330
- * `data` *(array)* — License creation data
331
-
332
- #### Usage Example:
333
- ```php
334
- // Hook when a license is issued via the admin manager
335
- add_action('fluent_cart_sl/license_issued', function ($data) {
336
- // Extract newly created license and input data
337
- $license = $data['license'];
338
- $createData = $data['data'];
339
-
340
- // Log manual license creation
341
- fluent_cart_add_log(
342
- 'License Issued via Manager',
343
- sprintf('License #%d issued manually', $license->id),
344
- 'info'
345
- );
346
- }, 10, 1);
347
- ```
348
-
349
- ---
350
-
351
- ### `license_renewed` (Pro)
352
- `fluent_cart/licensing/license_renewed` — Fires when a license expiration is extended on subscription renewal
353
-
354
- * **When it runs:** This action fires when a license's expiration date is extended because the associated subscription has been successfully renewed.
355
- * **Source:** `fluent-cart-pro/app/Modules/Licensing/Hooks/Handlers/LicenseGenerationHandler.php` (line 231)
356
-
357
- #### Parameters:
358
- `$data` *(array)*: License renewal data
359
- * `license` *(\FluentCart\App\Models\License)* — The renewed license
360
- * `subscription` *(\FluentCart\App\Models\Subscription)* — The associated subscription
361
- * `prev_status` *(string)* — The previous license status
362
-
363
- #### Usage Example:
364
- ```php
365
- // Hook when a license expiration is extended on subscription renewal
366
- add_action('fluent_cart/licensing/license_renewed', function ($data) {
367
- // Extract license, subscription, and previous status
368
- $license = $data['license'];
369
- $subscription = $data['subscription'];
370
- $prevStatus = $data['prev_status'];
371
-
372
- // Log license renewal event
373
- fluent_cart_add_log(
374
- 'License Renewed',
375
- sprintf('License #%d renewed via subscription #%d', $license->id, $subscription->id),
376
- 'info'
377
- );
378
- }, 10, 1);
379
- ```
380
-
381
- ---
382
-
383
- ### `license_expired` (Pro)
384
- `fluent_cart/licensing/license_expired` — Fires when a license expires due to subscription cancellation or scheduler
385
-
386
- * **When it runs:** This action fires when a license is marked as expired, either because the associated subscription was cancelled or because the license scheduler determined it has passed its expiration date.
387
- * **Source:** `fluent-cart-pro/app/Modules/Licensing/Hooks/Handlers/LicenseGenerationHandler.php` (line 267), `fluent-cart-pro/app/Modules/Licensing/Hooks/Handlers/LicenseSchedulerHandler.php` (line 46)
388
-
389
- #### Parameters:
390
- `$data` *(array)*: License expiration data
391
- * `license` *(\FluentCart\App\Models\License)* — The expired license
392
- * `subscription` *(\FluentCart\App\Models\Subscription)* — The associated subscription
393
- * `prev_status` *(string)* — The previous license status
394
-
395
- #### Usage Example:
396
- ```php
397
- // Hook when a license expires due to subscription cancellation or scheduler
398
- add_action('fluent_cart/licensing/license_expired', function ($data) {
399
- // Extract license, subscription, and previous status
400
- $license = $data['license'];
401
- $subscription = $data['subscription'];
402
- $prevStatus = $data['prev_status'];
403
-
404
- // Notify customer about license expiration via email
405
- wp_mail(
406
- $license->customer->email,
407
- 'License Expired',
408
- sprintf('Your license #%d has expired.', $license->id)
409
- );
410
- }, 10, 1);
411
- ```
412
-
413
- ---
414
-
415
- ### `license_disabled` (Pro)
416
- `fluent_cart/licensing/license_disabled` — Fires when a license is disabled due to payment failure or refund
417
-
418
- * **When it runs:** This action fires when a license is disabled, typically because the associated order's payment failed or a refund was processed.
419
- * **Source:** `fluent-cart-pro/app/Modules/Licensing/Hooks/Handlers/LicenseGenerationHandler.php` (lines 158, 196)
420
-
421
- #### Parameters:
422
- `$data` *(array)*: License disabled data
423
- * `license` *(\FluentCart\App\Models\License)* — The disabled license
424
- * `order` *(\FluentCart\App\Models\Order)* — The associated order
425
- * `reason` *(string|undefined)* — The reason for disabling (only present on payment failure; absent on refund)
426
-
427
- #### Usage Example:
428
- ```php
429
- // Hook when a license is disabled due to payment failure or refund
430
- add_action('fluent_cart/licensing/license_disabled', function ($data) {
431
- // Extract license, order, and disabling reason
432
- $license = $data['license'];
433
- $order = $data['order'];
434
- $reason = $data['reason'] ?? '';
435
-
436
- // Log license disable event
437
- fluent_cart_add_log(
438
- 'License Disabled',
439
- sprintf('License #%d disabled for order #%d. Reason: %s', $license->id, $order->id, $reason ?: 'refund'),
440
- 'warning'
441
- );
442
- }, 10, 1);
443
- ```
444
-
445
- ---
446
-
447
- ### `extended_to_lifetime` (Pro)
448
- `fluent_cart/licensing/extended_to_lifetime` — Fires when a license is extended to lifetime on subscription end-of-term
449
-
450
- * **When it runs:** This action fires when a license is converted to a lifetime license because its associated subscription has completed all billing cycles (end-of-term).
451
- * **Source:** `fluent-cart-pro/app/Modules/Licensing/Hooks/Handlers/LicenseGenerationHandler.php` (line 302)
452
-
453
- #### Parameters:
454
- `$data` *(array)*: License lifetime extension data
455
- * `license` *(\FluentCart\App\Models\License)* — The license extended to lifetime
456
- * `subscription` *(\FluentCart\App\Models\Subscription)* — The associated subscription
457
- * `prev_status` *(string)* — The previous license status
458
-
459
- #### Usage Example:
460
- ```php
461
- // Hook when a license is extended to lifetime on subscription end-of-term
462
- add_action('fluent_cart/licensing/extended_to_lifetime', function ($data) {
463
- // Extract license, subscription, and previous status
464
- $license = $data['license'];
465
- $subscription = $data['subscription'];
466
- $prevStatus = $data['prev_status'];
467
-
468
- // Notify customer about lifetime upgrade via email
469
- wp_mail(
470
- $license->customer->email,
471
- 'License Extended to Lifetime',
472
- sprintf('Your license #%d has been extended to lifetime access!', $license->id)
473
- );
474
- }, 10, 1);
475
- ```
476
-
477
- ---
478
-
479
- ### `license_upgraded` (Pro)
480
- `fluent_cart/licensing/license_upgraded` — Fires when a license is upgraded to a new plan
481
-
482
- * **When it runs:** This action fires when a license is upgraded to a different plan, typically through a plan change or upgrade flow.
483
- * **Source:** `fluent-cart-pro/app/Modules/Licensing/Hooks/Handlers/LicenseGenerationHandler.php` (line 375)
484
-
485
- #### Parameters:
486
- `$data` *(array)*: License upgrade data
487
- * `license` *(\FluentCart\App\Models\License)* — The upgraded license
488
- * `order` *(\FluentCart\App\Models\Order)* — The associated order
489
- * `subscription` *(\FluentCart\App\Models\Subscription)* — The associated subscription
490
- * `updates` *(array)* — The update data applied to the license
491
-
492
- #### Usage Example:
493
- ```php
494
- // Hook when a license is upgraded to a new plan
495
- add_action('fluent_cart/licensing/license_upgraded', function ($data) {
496
- // Extract upgraded license, order, subscription, and update parameters
497
- $license = $data['license'];
498
- $order = $data['order'];
499
- $subscription = $data['subscription'];
500
- $updates = $data['updates'];
501
-
502
- // Log license upgrade event
503
- fluent_cart_add_log(
504
- 'License Upgraded',
505
- sprintf('License #%d upgraded for order #%d', $license->id, $order->id),
506
- 'info'
507
- );
508
- }, 10, 1);
509
- ```
510
-
511
- ---
512
-
513
- ### `license_deleted` (admin) (Pro)
514
- `fluent_cart_sl/license_deleted` — Fires when a license is deleted from the admin interface
515
-
516
- * **When it runs:** This action fires when an admin deletes a license through the license management UI.
517
- * **Source:** `fluent-cart-pro/app/Modules/Licensing/Http/Controllers/LicenseController.php` (line 255)
518
-
519
- #### Parameters:
520
- `$data` *(array)*: License deletion data
521
- * `license` *(\FluentCart\App\Models\License)* — The license being deleted
522
-
523
- #### Usage Example:
524
- ```php
525
- // Hook when a license is deleted from the admin interface
526
- add_action('fluent_cart_sl/license_deleted', function ($data) {
527
- // Extract deleted license model instance
528
- $license = $data['license'];
529
-
530
- // Log admin license deletion
531
- fluent_cart_add_log(
532
- 'License Deleted',
533
- sprintf('License #%d was deleted by admin', $license->id),
534
- 'warning'
535
- );
536
- }, 10, 1);
537
- ```
538
-
539
- ---
540
-
541
- ### `license_deleted` (order deleted) (Pro)
542
- `fluent_cart/licensing/license_deleted` — Fires when a license is deleted because its parent order was deleted
543
-
544
- * **When it runs:** This action fires when a license is automatically deleted as a result of its parent order being deleted.
545
- * **Source:** `fluent-cart-pro/app/Modules/Licensing/Hooks/license-actions.php` (line 141)
546
-
547
- #### Parameters:
548
- `$data` *(array)*: License deletion data
549
- * `license` *(\FluentCart\App\Models\License)* — The license being deleted
550
- * `order` *(\FluentCart\App\Models\Order)* — The parent order being deleted
551
-
552
- #### Usage Example:
553
- ```php
554
- // Hook when a license is deleted because its parent order was deleted
555
- add_action('fluent_cart/licensing/license_deleted', function ($data) {
556
- // Extract license and parent order being deleted
557
- $license = $data['license'];
558
- $order = $data['order'];
559
-
560
- // Log automatic license deletion with order
561
- fluent_cart_add_log(
562
- 'License Deleted with Order',
563
- sprintf('License #%d deleted because order #%d was deleted', $license->id, $order->id),
564
- 'warning'
565
- );
566
- }, 10, 1);
567
- ```
568
-
569
- ---
570
-
571
- ## License Site Activation
572
-
573
- ### `site_activated` (API) (Pro)
574
- `fluent_cart/license/site_activated` — Fires when a site is activated for a license via the public API
575
-
576
- * **When it runs:** This action fires when a site is successfully activated for a license through the external licensing API.
577
- * **Source:** `fluent-cart-pro/app/Modules/Licensing/Hooks/Handlers/LicenseApiHandler.php` (line 255)
578
-
579
- #### Parameters:
580
- * `$site` *(\FluentCart\App\Models\LicenseSite)* — The activated site
581
- * `$activation` *(\FluentCart\App\Models\LicenseActivation)* — The license activation record
582
- * `$license` *(\FluentCart\App\Models\License)* — The associated license
583
- * `$data` *(array)* — The activation request data
584
-
585
- #### Usage Example:
586
- ```php
587
- // Hook when a site is activated for a license via the public API
588
- add_action('fluent_cart/license/site_activated', function ($site, $activation, $license, $data) {
589
- // Log API site activation event
590
- fluent_cart_add_log(
591
- 'Site Activated via API',
592
- sprintf('Site %s activated for license #%d', $site->site_url, $license->id),
593
- 'info'
594
- );
595
- }, 10, 4);
596
- ```
597
-
598
- ---
599
-
600
- ### `site_deactivated` (API) (Pro)
601
- `fluent_cart/license/site_deactivated` — Fires when a site is deactivated via the public API
602
-
603
- * **When it runs:** This action fires when a site is successfully deactivated for a license through the external licensing API.
604
- * **Source:** `fluent-cart-pro/app/Modules/Licensing/Hooks/Handlers/LicenseApiHandler.php` (line 340)
605
-
606
- #### Parameters:
607
- * `$site` *(\FluentCart\App\Models\LicenseSite)* — The deactivated site
608
- * `$activation` *(\FluentCart\App\Models\LicenseActivation)* — The license activation record
609
- * `$license` *(\FluentCart\App\Models\License)* — The associated license
610
- * `$data` *(array)* — The deactivation request data
611
-
612
- #### Usage Example:
613
- ```php
614
- // Hook when a site is deactivated via the public API
615
- add_action('fluent_cart/license/site_deactivated', function ($site, $activation, $license, $data) {
616
- // Log API site deactivation event
617
- fluent_cart_add_log(
618
- 'Site Deactivated via API',
619
- sprintf('Site %s deactivated for license #%d', $site->site_url, $license->id),
620
- 'info'
621
- );
622
- }, 10, 4);
623
- ```
624
-
625
- ---
626
-
627
- ### `site_deactivated_failed` (Pro)
628
- `fluent_cart/license/site_deactivated_failed` — Fires when a site deactivation attempt fails
629
-
630
- * **When it runs:** This action fires when a site deactivation request fails. This can happen for multiple reasons such as an invalid license key, site not found, or activation mismatch.
631
- * **Source:** `fluent-cart-pro/app/Modules/Licensing/Hooks/Handlers/LicenseApiHandler.php` (lines 295, 309, 321)
632
-
633
- #### Parameters:
634
- * `$formattedData` *(array)* — Error information including the reason for failure
635
-
636
- #### Usage Example:
637
- ```php
638
- // Hook when a site deactivation attempt fails
639
- add_action('fluent_cart/license/site_deactivated_failed', function ($formattedData) {
640
- // Log failed site deactivation error payload
641
- fluent_cart_add_log(
642
- 'Site Deactivation Failed',
643
- wp_json_encode($formattedData),
644
- 'error'
645
- );
646
- }, 10, 1);
647
- ```
648
-
649
- ---
650
-
651
- ### `site_activated` (local) (Pro)
652
- `fluent_cart_sl/site_activated` — Fires when a site is activated via the local API method
653
-
654
- * **When it runs:** This action fires when a site is activated through the internal (local) license site management method.
655
- * **Source:** `fluent-cart-pro/app/Modules/Licensing/Concerns/CanManageLicenseSites.php` (line 84)
656
-
657
- #### Parameters:
658
- `$data` *(array)*: Site activation data
659
- * `site` *(\FluentCart\App\Models\LicenseSite)* — The activated site
660
- * `license` *(\FluentCart\App\Models\License)* — The associated license
661
- * `activation` *(\FluentCart\App\Models\LicenseActivation)* — The license activation record
662
-
663
- #### Usage Example:
664
- ```php
665
- // Hook when a site is activated via the local API method
666
- add_action('fluent_cart_sl/site_activated', function ($data) {
667
- // Extract site, license, and activation models
668
- $site = $data['site'];
669
- $license = $data['license'];
670
- $activation = $data['activation'];
671
-
672
- // Log local site activation event
673
- fluent_cart_add_log(
674
- 'Site Activated Locally',
675
- sprintf('Site %s activated for license #%d', $site->site_url, $license->id),
676
- 'info'
677
- );
678
- }, 10, 1);
679
- ```
680
-
681
- ---
682
-
683
- ### `site_license_deactivated` (Pro)
684
- `fluent_cart_sl/site_license_deactivated` — Fires when a license is deactivated from a site (admin or customer)
685
-
686
- * **When it runs:** This action fires when a license is deactivated from a specific site, either by an admin through the management interface or by the customer through their profile.
687
- * **Source:** `fluent-cart-pro/app/Modules/Licensing/Concerns/CanManageLicenseSites.php` (lines 141, 177), `fluent-cart-pro/app/Modules/Licensing/Http/Controllers/CustomerProfileController.php` (line 192)
688
-
689
- #### Parameters:
690
- `$data` *(array)*: Site deactivation data
691
- * `site` *(\FluentCart\App\Models\LicenseSite)* — The site being deactivated
692
- * `license` *(\FluentCart\App\Models\License)* — The associated license
693
-
694
- #### Usage Example:
695
- ```php
696
- // Hook when a license is deactivated from a site (admin or customer)
697
- add_action('fluent_cart_sl/site_license_deactivated', function ($data) {
698
- // Extract site and license model instances
699
- $site = $data['site'];
700
- $license = $data['license'];
701
-
702
- // Log site license deactivation
703
- fluent_cart_add_log(
704
- 'Site License Deactivated',
705
- sprintf('License #%d deactivated from site %s', $license->id, $site->site_url),
706
- 'info'
707
- );
708
- }, 10, 1);
709
- ```
710
-
711
- ---
712
-
713
- ## Bulk License Operations
714
-
715
- ### `before_deleting_licenses` (Pro)
716
- `fluent_cart_sl/before_deleting_licenses` — Fires before licenses are bulk deleted by order
717
-
718
- * **When it runs:** This action fires immediately before a collection of licenses is deleted as part of a bulk operation (e.g., when an order is deleted).
719
- * **Source:** `fluent-cart-pro/app/Modules/Licensing/Services/LicenseManager.php` (line 232)
720
-
721
- #### Parameters:
722
- `$data` *(array)*: Bulk deletion data
723
- * `licenses` *(\Illuminate\Support\Collection)* — Collection of License models about to be deleted
724
-
725
- #### Usage Example:
726
- ```php
727
- // Hook before licenses are bulk deleted by order
728
- add_action('fluent_cart_sl/before_deleting_licenses', function ($data) {
729
- // Extract collection of licenses about to be deleted
730
- $licenses = $data['licenses'];
731
-
732
- // Log each license in bulk deletion queue
733
- foreach ($licenses as $license) {
734
- fluent_cart_add_log('License Bulk Delete', sprintf('About to delete license #%d', $license->id), 'warning');
735
- }
736
- }, 10, 1);
737
- ```
738
-
739
- ---
740
-
741
- ### `after_deleting_licenses` (Pro)
742
- `fluent_cart_sl/after_deleting_licenses` — Fires after licenses are bulk deleted
743
-
744
- * **When it runs:** This action fires immediately after a collection of licenses has been deleted.
745
- * **Source:** `fluent-cart-pro/app/Modules/Licensing/Services/LicenseManager.php` (line 237)
746
-
747
- #### Parameters:
748
- `$data` *(array)*: Bulk deletion data
749
- * `licenses` *(\Illuminate\Support\Collection)* — Collection of License models that were deleted
750
-
751
- #### Usage Example:
752
- ```php
753
- // Hook after licenses are bulk deleted
754
- add_action('fluent_cart_sl/after_deleting_licenses', function ($data) {
755
- // Extract collection of deleted licenses
756
- $licenses = $data['licenses'];
757
-
758
- // Log completion of bulk license deletion
759
- fluent_cart_add_log('Licenses Bulk Deleted', sprintf('%d licenses were deleted', $licenses->count()), 'warning');
760
- }, 10, 1);
761
- ```
762
-
763
- ---
764
-
765
- ### `before_updating_licenses_status` (Pro)
766
- `fluent_cart_sl/before_updating_licenses_status` — Fires before a bulk license status update
767
-
768
- * **When it runs:** This action fires immediately before a collection of licenses has their status updated in bulk.
769
- * **Source:** `fluent-cart-pro/app/Modules/Licensing/Services/LicenseManager.php` (line 285)
770
-
771
- #### Parameters:
772
- `$data` *(array)*: Bulk status update data
773
- * `licenses` *(\Illuminate\Support\Collection)* — Collection of License models about to be updated
774
-
775
- #### Usage Example:
776
- ```php
777
- // Hook before a bulk license status update
778
- add_action('fluent_cart_sl/before_updating_licenses_status', function ($data) {
779
- // Extract collection of licenses about to be updated
780
- $licenses = $data['licenses'];
781
-
782
- // Log or validate before bulk status change
783
- }, 10, 1);
784
- ```
785
-
786
- ---
787
-
788
- ### `before_updating_licenses_status_to_disabled` (Pro)
789
- `fluent_cart_sl/before_updating_licenses_status_to_disabled` — Fires before licenses are bulk disabled
790
-
791
- * **When it runs:** This action fires immediately before a collection of licenses is bulk-disabled.
792
- * **Source:** `fluent-cart-pro/app/Modules/Licensing/Services/LicenseManager.php` (line 286)
793
-
794
- #### Parameters:
795
- `$data` *(array)*: Bulk disable data
796
- * `licenses` *(\Illuminate\Support\Collection)* — Collection of License models about to be disabled
797
-
798
- #### Usage Example:
799
- ```php
800
- // Hook before licenses are bulk disabled
801
- add_action('fluent_cart_sl/before_updating_licenses_status_to_disabled', function ($data) {
802
- // Extract collection of licenses about to be disabled
803
- $licenses = $data['licenses'];
804
-
805
- // Perform pre-disable checks
806
- }, 10, 1);
807
- ```
808
-
809
- ---
810
-
811
- ### `after_updating_licenses_status` (Pro)
812
- `fluent_cart_sl/after_updating_licenses_status` — Fires after a bulk license status update
813
-
814
- * **When it runs:** This action fires immediately after a collection of licenses has had their status updated in bulk.
815
- * **Source:** `fluent-cart-pro/app/Modules/Licensing/Services/LicenseManager.php` (line 290)
816
-
817
- #### Parameters:
818
- `$data` *(array)*: Bulk status update data
819
- * `licenses` *(\Illuminate\Support\Collection)* — Collection of License models that were updated
820
-
821
- #### Usage Example:
822
- ```php
823
- // Hook after a bulk license status update
824
- add_action('fluent_cart_sl/after_updating_licenses_status', function ($data) {
825
- // Extract collection of updated license models
826
- $licenses = $data['licenses'];
827
-
828
- // Log completion of bulk status update
829
- fluent_cart_add_log('Licenses Status Updated', sprintf('%d licenses updated', $licenses->count()), 'info');
830
- }, 10, 1);
831
- ```
832
-
833
- ---
834
-
835
- ### `after_updating_licenses_status_to_disabled` (Pro)
836
- `fluent_cart_sl/after_updating_licenses_status_to_disabled` — Fires after licenses are bulk disabled
837
-
838
- * **When it runs:** This action fires immediately after a collection of licenses has been bulk-disabled.
839
- * **Source:** `fluent-cart-pro/app/Modules/Licensing/Services/LicenseManager.php` (line 291)
840
-
841
- #### Parameters:
842
- `$data` *(array)*: Bulk disable data
843
- * `licenses` *(\Illuminate\Support\Collection)* — Collection of License models that were disabled
844
-
845
- #### Usage Example:
846
- ```php
847
- // Hook after licenses are bulk disabled
848
- add_action('fluent_cart_sl/after_updating_licenses_status_to_disabled', function ($data) {
849
- // Extract collection of disabled license models
850
- $licenses = $data['licenses'];
851
-
852
- // Log completion of bulk disable action
853
- fluent_cart_add_log('Licenses Bulk Disabled', sprintf('%d licenses disabled', $licenses->count()), 'warning');
854
- }, 10, 1);
855
- ```
1
+ # Action Hooks: Licenses (Pro)
2
+
3
+ Action hooks for software licensing lifecycle management including License status changes, `LicenseActivation` management, `LicenseSite` activations/deactivations, and bulk operations. All hooks in this section require the FluentCart Pro plugin.
4
+
5
+ ---
6
+
7
+ ## License Status
8
+
9
+ ### `license_status_updated` (Pro)
10
+ `fluent_cart_sl/license_status_updated` — Fires on any license status change
11
+
12
+ * **When it runs:** This action fires whenever a License's status transitions from one value to another (e.g., `active` to `expired`, `active` to `disabled`, etc.).
13
+ * **Source:** `fluent-cart-pro/app/Modules/Licensing/Models/License.php` (line 206)
14
+
15
+ #### Parameters:
16
+ `$data` *(array)*: License status change data
17
+ * `license` *(\FluentCart\App\Models\License)* — The license model after the status change
18
+ * `old_status` *(string)* — The previous status value
19
+ * `new_status` *(string)* — The new status value
20
+
21
+ #### Usage Example:
22
+ ```php
23
+ // Hook into any license status update
24
+ add_action('fluent_cart_sl/license_status_updated', function ($data) {
25
+ // Extract license model and status transition strings
26
+ $license = $data['license'];
27
+ $oldStatus = $oldStatus = $data['old_status'];
28
+ $newStatus = $data['new_status'];
29
+
30
+ // Log status change to system log
31
+ fluent_cart_add_log(
32
+ 'License Status Changed',
33
+ sprintf('License #%d changed from %s to %s', $license->id, $oldStatus, $newStatus),
34
+ 'info'
35
+ );
36
+ }, 10, 1);
37
+ ```
38
+
39
+ ---
40
+
41
+ ### `license_status_updated_to_{$newStatus}` (Pro)
42
+ `fluent_cart_sl/license_status_updated_to_{$newStatus}` — Fires when a license transitions to a specific status
43
+
44
+ * **When it runs:** This is a dynamic hook that fires for a specific target status. For example, `fluent_cart_sl/license_status_updated_to_expired` fires only when a License becomes expired.
45
+ * **Source:** `fluent-cart-pro/app/Modules/Licensing/Models/License.php` (line 211)
46
+
47
+ #### Parameters:
48
+ `$data` *(array)*: License status change data
49
+ * `license` *(\FluentCart\App\Models\License)* — The license model after the status change
50
+ * `old_status` *(string)* — The previous status value
51
+ * `new_status` *(string)* — The new status value
52
+
53
+ #### Usage Example:
54
+ ```php
55
+ // Hook when a license transitions to expired status
56
+ add_action('fluent_cart_sl/license_status_updated_to_expired', function ($data) {
57
+ // Extract license model and status values
58
+ $license = $data['license'];
59
+ $oldStatus = $data['old_status'];
60
+ $newStatus = $data['new_status'];
61
+
62
+ // Handle license expiration notification via email
63
+ wp_mail(get_option('admin_email'), 'License Expired', sprintf('License #%d has expired.', $license->id));
64
+ }, 10, 1);
65
+ ```
66
+
67
+ ---
68
+
69
+ ## License Activation Status
70
+
71
+ ### `license_activation_status_updated` (Pro)
72
+ `fluent_cart_sl/license_activation_status_updated` — Fires on any license activation status change
73
+
74
+ * **When it runs:** This action fires whenever a `LicenseActivation`'s status transitions from one value to another.
75
+ * **Source:** `fluent-cart-pro/app/Modules/Licensing/Models/LicenseActivation.php` (line 52)
76
+
77
+ #### Parameters:
78
+ `$data` *(array)*: License activation status change data
79
+ * `license` *(\FluentCart\App\Models\LicenseActivation)* — The license activation model (note: key is `license` but value is a `LicenseActivation` instance)
80
+ * `old_status` *(string)* — The previous activation status
81
+ * `new_status` *(string)* — The new activation status
82
+
83
+ #### Usage Example:
84
+ ```php
85
+ // Hook into any license activation status change
86
+ add_action('fluent_cart_sl/license_activation_status_updated', function ($data) {
87
+ // Extract activation instance and status strings
88
+ $activation = $data['license']; // Note: key is 'license' but value is a LicenseActivation instance
89
+ $oldStatus = $data['old_status'];
90
+ $newStatus = $data['new_status'];
91
+
92
+ // Log activation status transition
93
+ fluent_cart_add_log(
94
+ 'License Activation Status Changed',
95
+ sprintf('Activation #%d status changed from %s to %s', $activation->id, $oldStatus, $newStatus),
96
+ 'info'
97
+ );
98
+ }, 10, 1);
99
+ ```
100
+
101
+ ---
102
+
103
+ ### `license_activation_status_updated_to_{$newStatus}` (Pro)
104
+ `fluent_cart_sl/license_activation_status_updated_to_{$newStatus}` — Fires when a license activation transitions to a specific status
105
+
106
+ * **When it runs:** This is a dynamic hook that fires for a specific target `LicenseActivation` status.
107
+ * **Source:** `fluent-cart-pro/app/Modules/Licensing/Models/LicenseActivation.php` (line 57)
108
+
109
+ #### Parameters:
110
+ `$data` *(array)*: License activation status change data
111
+ * `license` *(\FluentCart\App\Models\LicenseActivation)* — The license activation model (note: key is `license` but value is a `LicenseActivation` instance)
112
+ * `old_status` *(string)* — The previous activation status
113
+ * `new_status` *(string)* — The new activation status
114
+
115
+ #### Usage Example:
116
+ ```php
117
+ // Hook when a license activation becomes active
118
+ add_action('fluent_cart_sl/license_activation_status_updated_to_active', function ($data) {
119
+ // Extract activation model instance
120
+ $activation = $data['license']; // Note: key is 'license' but value is a LicenseActivation instance
121
+ $oldStatus = $data['old_status'];
122
+ $newStatus = $data['new_status'];
123
+
124
+ // Handle activation becoming active
125
+ }, 10, 1);
126
+ ```
127
+
128
+ ---
129
+
130
+ ## License Limits
131
+
132
+ ### `license_limit_increased` (activation count) (Pro)
133
+ `fluent_cart_sl/license_limit_increased` — Fires when the license activation count is increased
134
+
135
+ * **When it runs:** This action fires when a License's activation count is increased.
136
+ * **Source:** `fluent-cart-pro/app/Modules/Licensing/Models/License.php` (line 224)
137
+
138
+ #### Parameters:
139
+ `$data` *(array)*: License limit change data
140
+ * `license` *(\FluentCart\App\Models\License)* — The license model
141
+ * `old_count` *(int)* — The previous activation count
142
+
143
+ #### Usage Example:
144
+ ```php
145
+ // Hook when the license activation count is increased
146
+ add_action('fluent_cart_sl/license_limit_increased', function ($data) {
147
+ // Extract license model and previous activation count
148
+ $license = $data['license'];
149
+ $oldCount = $data['old_count'];
150
+
151
+ // Log activation count increase
152
+ fluent_cart_add_log(
153
+ 'License Activation Count Increased',
154
+ sprintf('License #%d activation count increased from %d', $license->id, $oldCount),
155
+ 'info'
156
+ );
157
+ }, 10, 1);
158
+ ```
159
+
160
+ ---
161
+
162
+ ### `license_limit_decreased` (Pro)
163
+ `fluent_cart_sl/license_limit_decreased` — Fires when the license activation count is decreased
164
+
165
+ * **When it runs:** This action fires when a License's activation count is decreased.
166
+ * **Source:** `fluent-cart-pro/app/Modules/Licensing/Models/License.php` (line 239)
167
+
168
+ #### Parameters:
169
+ `$data` *(array)*: License limit change data
170
+ * `license` *(\FluentCart\App\Models\License)* — The license model
171
+ * `old_count` *(int)* — The previous activation count
172
+
173
+ #### Usage Example:
174
+ ```php
175
+ // Hook when the license activation count is decreased
176
+ add_action('fluent_cart_sl/license_limit_decreased', function ($data) {
177
+ // Extract license model and previous activation count
178
+ $license = $data['license'];
179
+ $oldCount = $data['old_count'];
180
+
181
+ // Log activation count decrease
182
+ fluent_cart_add_log(
183
+ 'License Activation Count Decreased',
184
+ sprintf('License #%d activation count decreased from %d', $license->id, $oldCount),
185
+ 'info'
186
+ );
187
+ }, 10, 1);
188
+ ```
189
+
190
+ ---
191
+
192
+ ### `license_limit_increased` (limit slots) (Pro)
193
+ `fluent_cart_sl/license_limit_increased` — Fires when the license activation limit (slots) is increased
194
+
195
+ * **When it runs:** This action fires when a License's activation limit (maximum allowed activations) is increased.
196
+ * **Source:** `fluent-cart-pro/app/Modules/Licensing/Models/License.php` (line 259)
197
+
198
+ #### Parameters:
199
+ `$data` *(array)*: License limit change data
200
+ * `license` *(\FluentCart\App\Models\License)* — The license model
201
+ * `old_count` *(int)* — The previous activation limit
202
+
203
+ #### Usage Example:
204
+ ```php
205
+ // Hook when the license activation limit (slots) is increased
206
+ add_action('fluent_cart_sl/license_limit_increased', function ($data) {
207
+ // Extract license model and previous limit count
208
+ $license = $data['license'];
209
+ $oldCount = $data['old_count'];
210
+
211
+ // Log activation limit increase
212
+ fluent_cart_add_log(
213
+ 'License Limit Increased',
214
+ sprintf('License #%d activation limit increased from %d', $license->id, $oldCount),
215
+ 'info'
216
+ );
217
+ }, 10, 1);
218
+ ```
219
+
220
+ ---
221
+
222
+ ## License Key & Validity
223
+
224
+ ### `license_key_regenerated` (Pro)
225
+ `fluent_cart_sl/license_key_regenerated` — Fires when a license key is regenerated
226
+
227
+ * **When it runs:** This action fires when a license key is regenerated, replacing the old key with a new one.
228
+ * **Source:** `fluent-cart-pro/app/Modules/Licensing/Models/License.php` (line 318)
229
+
230
+ #### Parameters:
231
+ `$data` *(array)*: License key change data
232
+ * `license` *(\FluentCart\App\Models\License)* — The license model with the new key
233
+ * `old_key` *(string)* — The previous license key
234
+
235
+ #### Usage Example:
236
+ ```php
237
+ // Hook when a license key is regenerated
238
+ add_action('fluent_cart_sl/license_key_regenerated', function ($data) {
239
+ // Extract license model and previous key string
240
+ $license = $data['license'];
241
+ $oldKey = $data['old_key'];
242
+
243
+ // Log license key regeneration event
244
+ fluent_cart_add_log(
245
+ 'License Key Regenerated',
246
+ sprintf('License #%d key was regenerated', $license->id),
247
+ 'info'
248
+ );
249
+ }, 10, 1);
250
+ ```
251
+
252
+ ---
253
+
254
+ ### `license_validity_extended` (Pro)
255
+ `fluent_cart_sl/license_validity_extended` — Fires when a license expiration date is changed
256
+
257
+ * **When it runs:** This action fires when a license's expiration date is modified to a new date.
258
+ * **Source:** `fluent-cart-pro/app/Modules/Licensing/Models/License.php` (line 348)
259
+
260
+ #### Parameters:
261
+ `$data` *(array)*: License validity change data
262
+ * `license` *(\FluentCart\App\Models\License)* — The license model
263
+ * `old_date` *(string)* — The previous expiration date
264
+ * `new_date` *(string)* — The new expiration date
265
+
266
+ #### Usage Example:
267
+ ```php
268
+ // Hook when a license expiration date is modified
269
+ add_action('fluent_cart_sl/license_validity_extended', function ($data) {
270
+ // Extract license model and expiration dates
271
+ $license = $data['license'];
272
+ $oldDate = $data['old_date'];
273
+ $newDate = $data['new_date'];
274
+
275
+ // Log license expiration change
276
+ fluent_cart_add_log(
277
+ 'License Validity Extended',
278
+ sprintf('License #%d expiration changed from %s to %s', $license->id, $oldDate, $newDate),
279
+ 'info'
280
+ );
281
+ }, 10, 1);
282
+ ```
283
+
284
+ ---
285
+
286
+ ## License Lifecycle
287
+
288
+ ### `license_issued` (order) (Pro)
289
+ `fluent_cart/licensing/license_issued` — Fires when a new license is created for an order
290
+
291
+ * **When it runs:** This action fires when a new license is generated as part of an order fulfillment process.
292
+ * **Source:** `fluent-cart-pro/app/Modules/Licensing/Hooks/Handlers/LicenseGenerationHandler.php` (line 532)
293
+
294
+ #### Parameters:
295
+ `$data` *(array)*: License issuance data
296
+ * `license` *(\FluentCart\App\Models\License)* — The newly created license
297
+ * `data` *(array)* — License creation data
298
+ * `order` *(\FluentCart\App\Models\Order)* — The associated order
299
+ * `subscription` *(\FluentCart\App\Models\Subscription|null)* — The associated subscription, if any
300
+
301
+ #### Usage Example:
302
+ ```php
303
+ // Hook when a new license is created for an order
304
+ add_action('fluent_cart/licensing/license_issued', function ($data) {
305
+ // Extract license, order, and subscription models
306
+ $license = $data['license'];
307
+ $order = $data['order'];
308
+ $subscription = $data['subscription'];
309
+
310
+ // Notify customer about their new license via email
311
+ wp_mail(
312
+ $order->customer->email,
313
+ 'Your License Key',
314
+ sprintf('Your license key for order #%d is: %s', $order->id, $license->license_key)
315
+ );
316
+ }, 10, 1);
317
+ ```
318
+
319
+ ---
320
+
321
+ ### `license_issued` (manager) (Pro)
322
+ `fluent_cart_sl/license_issued` — Fires when a license is issued via the license manager
323
+
324
+ * **When it runs:** This action fires when a license is created through the admin license management interface.
325
+ * **Source:** `fluent-cart-pro/app/Modules/Licensing/Services/LicenseManager.php` (line 261)
326
+
327
+ #### Parameters:
328
+ `$data` *(array)*: License issuance data
329
+ * `license` *(\FluentCart\App\Models\License)* — The newly created license
330
+ * `data` *(array)* — License creation data
331
+
332
+ #### Usage Example:
333
+ ```php
334
+ // Hook when a license is issued via the admin manager
335
+ add_action('fluent_cart_sl/license_issued', function ($data) {
336
+ // Extract newly created license and input data
337
+ $license = $data['license'];
338
+ $createData = $data['data'];
339
+
340
+ // Log manual license creation
341
+ fluent_cart_add_log(
342
+ 'License Issued via Manager',
343
+ sprintf('License #%d issued manually', $license->id),
344
+ 'info'
345
+ );
346
+ }, 10, 1);
347
+ ```
348
+
349
+ ---
350
+
351
+ ### `license_renewed` (Pro)
352
+ `fluent_cart/licensing/license_renewed` — Fires when a license expiration is extended on subscription renewal
353
+
354
+ * **When it runs:** This action fires when a license's expiration date is extended because the associated subscription has been successfully renewed.
355
+ * **Source:** `fluent-cart-pro/app/Modules/Licensing/Hooks/Handlers/LicenseGenerationHandler.php` (line 231)
356
+
357
+ #### Parameters:
358
+ `$data` *(array)*: License renewal data
359
+ * `license` *(\FluentCart\App\Models\License)* — The renewed license
360
+ * `subscription` *(\FluentCart\App\Models\Subscription)* — The associated subscription
361
+ * `prev_status` *(string)* — The previous license status
362
+
363
+ #### Usage Example:
364
+ ```php
365
+ // Hook when a license expiration is extended on subscription renewal
366
+ add_action('fluent_cart/licensing/license_renewed', function ($data) {
367
+ // Extract license, subscription, and previous status
368
+ $license = $data['license'];
369
+ $subscription = $data['subscription'];
370
+ $prevStatus = $data['prev_status'];
371
+
372
+ // Log license renewal event
373
+ fluent_cart_add_log(
374
+ 'License Renewed',
375
+ sprintf('License #%d renewed via subscription #%d', $license->id, $subscription->id),
376
+ 'info'
377
+ );
378
+ }, 10, 1);
379
+ ```
380
+
381
+ ---
382
+
383
+ ### `license_expired` (Pro)
384
+ `fluent_cart/licensing/license_expired` — Fires when a license expires due to subscription cancellation or scheduler
385
+
386
+ * **When it runs:** This action fires when a license is marked as expired, either because the associated subscription was cancelled or because the license scheduler determined it has passed its expiration date.
387
+ * **Source:** `fluent-cart-pro/app/Modules/Licensing/Hooks/Handlers/LicenseGenerationHandler.php` (line 267), `fluent-cart-pro/app/Modules/Licensing/Hooks/Handlers/LicenseSchedulerHandler.php` (line 46)
388
+
389
+ #### Parameters:
390
+ `$data` *(array)*: License expiration data
391
+ * `license` *(\FluentCart\App\Models\License)* — The expired license
392
+ * `subscription` *(\FluentCart\App\Models\Subscription)* — The associated subscription
393
+ * `prev_status` *(string)* — The previous license status
394
+
395
+ #### Usage Example:
396
+ ```php
397
+ // Hook when a license expires due to subscription cancellation or scheduler
398
+ add_action('fluent_cart/licensing/license_expired', function ($data) {
399
+ // Extract license, subscription, and previous status
400
+ $license = $data['license'];
401
+ $subscription = $data['subscription'];
402
+ $prevStatus = $data['prev_status'];
403
+
404
+ // Notify customer about license expiration via email
405
+ wp_mail(
406
+ $license->customer->email,
407
+ 'License Expired',
408
+ sprintf('Your license #%d has expired.', $license->id)
409
+ );
410
+ }, 10, 1);
411
+ ```
412
+
413
+ ---
414
+
415
+ ### `license_disabled` (Pro)
416
+ `fluent_cart/licensing/license_disabled` — Fires when a license is disabled due to payment failure or refund
417
+
418
+ * **When it runs:** This action fires when a license is disabled, typically because the associated order's payment failed or a refund was processed.
419
+ * **Source:** `fluent-cart-pro/app/Modules/Licensing/Hooks/Handlers/LicenseGenerationHandler.php` (lines 158, 196)
420
+
421
+ #### Parameters:
422
+ `$data` *(array)*: License disabled data
423
+ * `license` *(\FluentCart\App\Models\License)* — The disabled license
424
+ * `order` *(\FluentCart\App\Models\Order)* — The associated order
425
+ * `reason` *(string|undefined)* — The reason for disabling (only present on payment failure; absent on refund)
426
+
427
+ #### Usage Example:
428
+ ```php
429
+ // Hook when a license is disabled due to payment failure or refund
430
+ add_action('fluent_cart/licensing/license_disabled', function ($data) {
431
+ // Extract license, order, and disabling reason
432
+ $license = $data['license'];
433
+ $order = $data['order'];
434
+ $reason = $data['reason'] ?? '';
435
+
436
+ // Log license disable event
437
+ fluent_cart_add_log(
438
+ 'License Disabled',
439
+ sprintf('License #%d disabled for order #%d. Reason: %s', $license->id, $order->id, $reason ?: 'refund'),
440
+ 'warning'
441
+ );
442
+ }, 10, 1);
443
+ ```
444
+
445
+ ---
446
+
447
+ ### `extended_to_lifetime` (Pro)
448
+ `fluent_cart/licensing/extended_to_lifetime` — Fires when a license is extended to lifetime on subscription end-of-term
449
+
450
+ * **When it runs:** This action fires when a license is converted to a lifetime license because its associated subscription has completed all billing cycles (end-of-term).
451
+ * **Source:** `fluent-cart-pro/app/Modules/Licensing/Hooks/Handlers/LicenseGenerationHandler.php` (line 302)
452
+
453
+ #### Parameters:
454
+ `$data` *(array)*: License lifetime extension data
455
+ * `license` *(\FluentCart\App\Models\License)* — The license extended to lifetime
456
+ * `subscription` *(\FluentCart\App\Models\Subscription)* — The associated subscription
457
+ * `prev_status` *(string)* — The previous license status
458
+
459
+ #### Usage Example:
460
+ ```php
461
+ // Hook when a license is extended to lifetime on subscription end-of-term
462
+ add_action('fluent_cart/licensing/extended_to_lifetime', function ($data) {
463
+ // Extract license, subscription, and previous status
464
+ $license = $data['license'];
465
+ $subscription = $data['subscription'];
466
+ $prevStatus = $data['prev_status'];
467
+
468
+ // Notify customer about lifetime upgrade via email
469
+ wp_mail(
470
+ $license->customer->email,
471
+ 'License Extended to Lifetime',
472
+ sprintf('Your license #%d has been extended to lifetime access!', $license->id)
473
+ );
474
+ }, 10, 1);
475
+ ```
476
+
477
+ ---
478
+
479
+ ### `license_upgraded` (Pro)
480
+ `fluent_cart/licensing/license_upgraded` — Fires when a license is upgraded to a new plan
481
+
482
+ * **When it runs:** This action fires when a license is upgraded to a different plan, typically through a plan change or upgrade flow.
483
+ * **Source:** `fluent-cart-pro/app/Modules/Licensing/Hooks/Handlers/LicenseGenerationHandler.php` (line 375)
484
+
485
+ #### Parameters:
486
+ `$data` *(array)*: License upgrade data
487
+ * `license` *(\FluentCart\App\Models\License)* — The upgraded license
488
+ * `order` *(\FluentCart\App\Models\Order)* — The associated order
489
+ * `subscription` *(\FluentCart\App\Models\Subscription)* — The associated subscription
490
+ * `updates` *(array)* — The update data applied to the license
491
+
492
+ #### Usage Example:
493
+ ```php
494
+ // Hook when a license is upgraded to a new plan
495
+ add_action('fluent_cart/licensing/license_upgraded', function ($data) {
496
+ // Extract upgraded license, order, subscription, and update parameters
497
+ $license = $data['license'];
498
+ $order = $data['order'];
499
+ $subscription = $data['subscription'];
500
+ $updates = $data['updates'];
501
+
502
+ // Log license upgrade event
503
+ fluent_cart_add_log(
504
+ 'License Upgraded',
505
+ sprintf('License #%d upgraded for order #%d', $license->id, $order->id),
506
+ 'info'
507
+ );
508
+ }, 10, 1);
509
+ ```
510
+
511
+ ---
512
+
513
+ ### `license_deleted` (admin) (Pro)
514
+ `fluent_cart_sl/license_deleted` — Fires when a license is deleted from the admin interface
515
+
516
+ * **When it runs:** This action fires when an admin deletes a license through the license management UI.
517
+ * **Source:** `fluent-cart-pro/app/Modules/Licensing/Http/Controllers/LicenseController.php` (line 255)
518
+
519
+ #### Parameters:
520
+ `$data` *(array)*: License deletion data
521
+ * `license` *(\FluentCart\App\Models\License)* — The license being deleted
522
+
523
+ #### Usage Example:
524
+ ```php
525
+ // Hook when a license is deleted from the admin interface
526
+ add_action('fluent_cart_sl/license_deleted', function ($data) {
527
+ // Extract deleted license model instance
528
+ $license = $data['license'];
529
+
530
+ // Log admin license deletion
531
+ fluent_cart_add_log(
532
+ 'License Deleted',
533
+ sprintf('License #%d was deleted by admin', $license->id),
534
+ 'warning'
535
+ );
536
+ }, 10, 1);
537
+ ```
538
+
539
+ ---
540
+
541
+ ### `license_deleted` (order deleted) (Pro)
542
+ `fluent_cart/licensing/license_deleted` — Fires when a license is deleted because its parent order was deleted
543
+
544
+ * **When it runs:** This action fires when a license is automatically deleted as a result of its parent order being deleted.
545
+ * **Source:** `fluent-cart-pro/app/Modules/Licensing/Hooks/license-actions.php` (line 141)
546
+
547
+ #### Parameters:
548
+ `$data` *(array)*: License deletion data
549
+ * `license` *(\FluentCart\App\Models\License)* — The license being deleted
550
+ * `order` *(\FluentCart\App\Models\Order)* — The parent order being deleted
551
+
552
+ #### Usage Example:
553
+ ```php
554
+ // Hook when a license is deleted because its parent order was deleted
555
+ add_action('fluent_cart/licensing/license_deleted', function ($data) {
556
+ // Extract license and parent order being deleted
557
+ $license = $data['license'];
558
+ $order = $data['order'];
559
+
560
+ // Log automatic license deletion with order
561
+ fluent_cart_add_log(
562
+ 'License Deleted with Order',
563
+ sprintf('License #%d deleted because order #%d was deleted', $license->id, $order->id),
564
+ 'warning'
565
+ );
566
+ }, 10, 1);
567
+ ```
568
+
569
+ ---
570
+
571
+ ## License Site Activation
572
+
573
+ ### `site_activated` (API) (Pro)
574
+ `fluent_cart/license/site_activated` — Fires when a site is activated for a license via the public API
575
+
576
+ * **When it runs:** This action fires when a site is successfully activated for a license through the external licensing API.
577
+ * **Source:** `fluent-cart-pro/app/Modules/Licensing/Hooks/Handlers/LicenseApiHandler.php` (line 255)
578
+
579
+ #### Parameters:
580
+ * `$site` *(\FluentCart\App\Models\LicenseSite)* — The activated site
581
+ * `$activation` *(\FluentCart\App\Models\LicenseActivation)* — The license activation record
582
+ * `$license` *(\FluentCart\App\Models\License)* — The associated license
583
+ * `$data` *(array)* — The activation request data
584
+
585
+ #### Usage Example:
586
+ ```php
587
+ // Hook when a site is activated for a license via the public API
588
+ add_action('fluent_cart/license/site_activated', function ($site, $activation, $license, $data) {
589
+ // Log API site activation event
590
+ fluent_cart_add_log(
591
+ 'Site Activated via API',
592
+ sprintf('Site %s activated for license #%d', $site->site_url, $license->id),
593
+ 'info'
594
+ );
595
+ }, 10, 4);
596
+ ```
597
+
598
+ ---
599
+
600
+ ### `site_deactivated` (API) (Pro)
601
+ `fluent_cart/license/site_deactivated` — Fires when a site is deactivated via the public API
602
+
603
+ * **When it runs:** This action fires when a site is successfully deactivated for a license through the external licensing API.
604
+ * **Source:** `fluent-cart-pro/app/Modules/Licensing/Hooks/Handlers/LicenseApiHandler.php` (line 340)
605
+
606
+ #### Parameters:
607
+ * `$site` *(\FluentCart\App\Models\LicenseSite)* — The deactivated site
608
+ * `$activation` *(\FluentCart\App\Models\LicenseActivation)* — The license activation record
609
+ * `$license` *(\FluentCart\App\Models\License)* — The associated license
610
+ * `$data` *(array)* — The deactivation request data
611
+
612
+ #### Usage Example:
613
+ ```php
614
+ // Hook when a site is deactivated via the public API
615
+ add_action('fluent_cart/license/site_deactivated', function ($site, $activation, $license, $data) {
616
+ // Log API site deactivation event
617
+ fluent_cart_add_log(
618
+ 'Site Deactivated via API',
619
+ sprintf('Site %s deactivated for license #%d', $site->site_url, $license->id),
620
+ 'info'
621
+ );
622
+ }, 10, 4);
623
+ ```
624
+
625
+ ---
626
+
627
+ ### `site_deactivated_failed` (Pro)
628
+ `fluent_cart/license/site_deactivated_failed` — Fires when a site deactivation attempt fails
629
+
630
+ * **When it runs:** This action fires when a site deactivation request fails. This can happen for multiple reasons such as an invalid license key, site not found, or activation mismatch.
631
+ * **Source:** `fluent-cart-pro/app/Modules/Licensing/Hooks/Handlers/LicenseApiHandler.php` (lines 295, 309, 321)
632
+
633
+ #### Parameters:
634
+ * `$formattedData` *(array)* — Error information including the reason for failure
635
+
636
+ #### Usage Example:
637
+ ```php
638
+ // Hook when a site deactivation attempt fails
639
+ add_action('fluent_cart/license/site_deactivated_failed', function ($formattedData) {
640
+ // Log failed site deactivation error payload
641
+ fluent_cart_add_log(
642
+ 'Site Deactivation Failed',
643
+ wp_json_encode($formattedData),
644
+ 'error'
645
+ );
646
+ }, 10, 1);
647
+ ```
648
+
649
+ ---
650
+
651
+ ### `site_activated` (local) (Pro)
652
+ `fluent_cart_sl/site_activated` — Fires when a site is activated via the local API method
653
+
654
+ * **When it runs:** This action fires when a site is activated through the internal (local) license site management method.
655
+ * **Source:** `fluent-cart-pro/app/Modules/Licensing/Concerns/CanManageLicenseSites.php` (line 84)
656
+
657
+ #### Parameters:
658
+ `$data` *(array)*: Site activation data
659
+ * `site` *(\FluentCart\App\Models\LicenseSite)* — The activated site
660
+ * `license` *(\FluentCart\App\Models\License)* — The associated license
661
+ * `activation` *(\FluentCart\App\Models\LicenseActivation)* — The license activation record
662
+
663
+ #### Usage Example:
664
+ ```php
665
+ // Hook when a site is activated via the local API method
666
+ add_action('fluent_cart_sl/site_activated', function ($data) {
667
+ // Extract site, license, and activation models
668
+ $site = $data['site'];
669
+ $license = $data['license'];
670
+ $activation = $data['activation'];
671
+
672
+ // Log local site activation event
673
+ fluent_cart_add_log(
674
+ 'Site Activated Locally',
675
+ sprintf('Site %s activated for license #%d', $site->site_url, $license->id),
676
+ 'info'
677
+ );
678
+ }, 10, 1);
679
+ ```
680
+
681
+ ---
682
+
683
+ ### `site_license_deactivated` (Pro)
684
+ `fluent_cart_sl/site_license_deactivated` — Fires when a license is deactivated from a site (admin or customer)
685
+
686
+ * **When it runs:** This action fires when a license is deactivated from a specific site, either by an admin through the management interface or by the customer through their profile.
687
+ * **Source:** `fluent-cart-pro/app/Modules/Licensing/Concerns/CanManageLicenseSites.php` (lines 141, 177), `fluent-cart-pro/app/Modules/Licensing/Http/Controllers/CustomerProfileController.php` (line 192)
688
+
689
+ #### Parameters:
690
+ `$data` *(array)*: Site deactivation data
691
+ * `site` *(\FluentCart\App\Models\LicenseSite)* — The site being deactivated
692
+ * `license` *(\FluentCart\App\Models\License)* — The associated license
693
+
694
+ #### Usage Example:
695
+ ```php
696
+ // Hook when a license is deactivated from a site (admin or customer)
697
+ add_action('fluent_cart_sl/site_license_deactivated', function ($data) {
698
+ // Extract site and license model instances
699
+ $site = $data['site'];
700
+ $license = $data['license'];
701
+
702
+ // Log site license deactivation
703
+ fluent_cart_add_log(
704
+ 'Site License Deactivated',
705
+ sprintf('License #%d deactivated from site %s', $license->id, $site->site_url),
706
+ 'info'
707
+ );
708
+ }, 10, 1);
709
+ ```
710
+
711
+ ---
712
+
713
+ ## Bulk License Operations
714
+
715
+ ### `before_deleting_licenses` (Pro)
716
+ `fluent_cart_sl/before_deleting_licenses` — Fires before licenses are bulk deleted by order
717
+
718
+ * **When it runs:** This action fires immediately before a collection of licenses is deleted as part of a bulk operation (e.g., when an order is deleted).
719
+ * **Source:** `fluent-cart-pro/app/Modules/Licensing/Services/LicenseManager.php` (line 232)
720
+
721
+ #### Parameters:
722
+ `$data` *(array)*: Bulk deletion data
723
+ * `licenses` *(\Illuminate\Support\Collection)* — Collection of License models about to be deleted
724
+
725
+ #### Usage Example:
726
+ ```php
727
+ // Hook before licenses are bulk deleted by order
728
+ add_action('fluent_cart_sl/before_deleting_licenses', function ($data) {
729
+ // Extract collection of licenses about to be deleted
730
+ $licenses = $data['licenses'];
731
+
732
+ // Log each license in bulk deletion queue
733
+ foreach ($licenses as $license) {
734
+ fluent_cart_add_log('License Bulk Delete', sprintf('About to delete license #%d', $license->id), 'warning');
735
+ }
736
+ }, 10, 1);
737
+ ```
738
+
739
+ ---
740
+
741
+ ### `after_deleting_licenses` (Pro)
742
+ `fluent_cart_sl/after_deleting_licenses` — Fires after licenses are bulk deleted
743
+
744
+ * **When it runs:** This action fires immediately after a collection of licenses has been deleted.
745
+ * **Source:** `fluent-cart-pro/app/Modules/Licensing/Services/LicenseManager.php` (line 237)
746
+
747
+ #### Parameters:
748
+ `$data` *(array)*: Bulk deletion data
749
+ * `licenses` *(\Illuminate\Support\Collection)* — Collection of License models that were deleted
750
+
751
+ #### Usage Example:
752
+ ```php
753
+ // Hook after licenses are bulk deleted
754
+ add_action('fluent_cart_sl/after_deleting_licenses', function ($data) {
755
+ // Extract collection of deleted licenses
756
+ $licenses = $data['licenses'];
757
+
758
+ // Log completion of bulk license deletion
759
+ fluent_cart_add_log('Licenses Bulk Deleted', sprintf('%d licenses were deleted', $licenses->count()), 'warning');
760
+ }, 10, 1);
761
+ ```
762
+
763
+ ---
764
+
765
+ ### `before_updating_licenses_status` (Pro)
766
+ `fluent_cart_sl/before_updating_licenses_status` — Fires before a bulk license status update
767
+
768
+ * **When it runs:** This action fires immediately before a collection of licenses has their status updated in bulk.
769
+ * **Source:** `fluent-cart-pro/app/Modules/Licensing/Services/LicenseManager.php` (line 285)
770
+
771
+ #### Parameters:
772
+ `$data` *(array)*: Bulk status update data
773
+ * `licenses` *(\Illuminate\Support\Collection)* — Collection of License models about to be updated
774
+
775
+ #### Usage Example:
776
+ ```php
777
+ // Hook before a bulk license status update
778
+ add_action('fluent_cart_sl/before_updating_licenses_status', function ($data) {
779
+ // Extract collection of licenses about to be updated
780
+ $licenses = $data['licenses'];
781
+
782
+ // Log or validate before bulk status change
783
+ }, 10, 1);
784
+ ```
785
+
786
+ ---
787
+
788
+ ### `before_updating_licenses_status_to_disabled` (Pro)
789
+ `fluent_cart_sl/before_updating_licenses_status_to_disabled` — Fires before licenses are bulk disabled
790
+
791
+ * **When it runs:** This action fires immediately before a collection of licenses is bulk-disabled.
792
+ * **Source:** `fluent-cart-pro/app/Modules/Licensing/Services/LicenseManager.php` (line 286)
793
+
794
+ #### Parameters:
795
+ `$data` *(array)*: Bulk disable data
796
+ * `licenses` *(\Illuminate\Support\Collection)* — Collection of License models about to be disabled
797
+
798
+ #### Usage Example:
799
+ ```php
800
+ // Hook before licenses are bulk disabled
801
+ add_action('fluent_cart_sl/before_updating_licenses_status_to_disabled', function ($data) {
802
+ // Extract collection of licenses about to be disabled
803
+ $licenses = $data['licenses'];
804
+
805
+ // Perform pre-disable checks
806
+ }, 10, 1);
807
+ ```
808
+
809
+ ---
810
+
811
+ ### `after_updating_licenses_status` (Pro)
812
+ `fluent_cart_sl/after_updating_licenses_status` — Fires after a bulk license status update
813
+
814
+ * **When it runs:** This action fires immediately after a collection of licenses has had their status updated in bulk.
815
+ * **Source:** `fluent-cart-pro/app/Modules/Licensing/Services/LicenseManager.php` (line 290)
816
+
817
+ #### Parameters:
818
+ `$data` *(array)*: Bulk status update data
819
+ * `licenses` *(\Illuminate\Support\Collection)* — Collection of License models that were updated
820
+
821
+ #### Usage Example:
822
+ ```php
823
+ // Hook after a bulk license status update
824
+ add_action('fluent_cart_sl/after_updating_licenses_status', function ($data) {
825
+ // Extract collection of updated license models
826
+ $licenses = $data['licenses'];
827
+
828
+ // Log completion of bulk status update
829
+ fluent_cart_add_log('Licenses Status Updated', sprintf('%d licenses updated', $licenses->count()), 'info');
830
+ }, 10, 1);
831
+ ```
832
+
833
+ ---
834
+
835
+ ### `after_updating_licenses_status_to_disabled` (Pro)
836
+ `fluent_cart_sl/after_updating_licenses_status_to_disabled` — Fires after licenses are bulk disabled
837
+
838
+ * **When it runs:** This action fires immediately after a collection of licenses has been bulk-disabled.
839
+ * **Source:** `fluent-cart-pro/app/Modules/Licensing/Services/LicenseManager.php` (line 291)
840
+
841
+ #### Parameters:
842
+ `$data` *(array)*: Bulk disable data
843
+ * `licenses` *(\Illuminate\Support\Collection)* — Collection of License models that were disabled
844
+
845
+ #### Usage Example:
846
+ ```php
847
+ // Hook after licenses are bulk disabled
848
+ add_action('fluent_cart_sl/after_updating_licenses_status_to_disabled', function ($data) {
849
+ // Extract collection of disabled license models
850
+ $licenses = $data['licenses'];
851
+
852
+ // Log completion of bulk disable action
853
+ fluent_cart_add_log('Licenses Bulk Disabled', sprintf('%d licenses disabled', $licenses->count()), 'warning');
854
+ }, 10, 1);
855
+ ```