PluginProbe
FluentCart A New Era of eCommerce – Faster, Lighter, and Simpler / 1.6.4
FluentCart A New Era of eCommerce – Faster, Lighter, and Simpler v1.6.4
1.6.4 1.6.3 1.6.2 1.6.1 1.6.0 1.5.4 1.5.5 1.5.3 1.5.2 1.5.1 1.5.0 1.4.2 1.4.1 1.4.0 1.3.28 1.3.27 1.3.26 1.3.25 1.3.23 1.3.22 1.3.21 1.3.20 1.3.19 trunk 1.2.0 All 47 releases
fluent-cart / app / Events / ProductVariationsChanged.php

ProductVariationsChanged.php in FluentCart A New Era of eCommerce – Faster, Lighter, and Simpler 1.6.4, at app/Events/ProductVariationsChanged.php

50 lines 1.2 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 namespace FluentCart\App\Events;
4
5 use FluentCart\App\Listeners\UpdateDefaultVariation;
6
7 /**
8 * Fired when a product's variation set changes in a way that can invalidate its
9 * default_variation_id — combinations regenerated/removed, or a variant set
10 * active/inactive. Distinct from StockChanged (which is broad and currently
11 * carries no default listener) so this stays scoped to variant-set mutations.
12 * UpdateDefaultVariation re-resolves the default to the first purchasable
13 * combination; works for every variation type.
14 */
15 class ProductVariationsChanged extends EventDispatcher
16 {
17 public string $hook = 'fluent_cart/product_variations_changed';
18
19 protected array $listeners = [
20 UpdateDefaultVariation::class,
21 ];
22
23 /**
24 * @var array $postIds
25 */
26 public $postIds;
27
28 public function __construct($postIds)
29 {
30 $this->postIds = $postIds;
31 }
32
33 public function toArray(): array
34 {
35 return [
36 'post_ids' => $this->postIds,
37 ];
38 }
39
40 public function getActivityEventModel()
41 {
42 return null;
43 }
44
45 public function shouldCreateActivity(): bool
46 {
47 return false;
48 }
49 }
50