1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
|
<?php
namespace AutomateWoo;
defined( 'ABSPATH' ) || exit;
/** * Class Trigger_Customer_Opted_In */ class Trigger_Customer_Opted_In extends Trigger {
/** * Sets the supplied data items. * * @var array */ public $supplied_data_items = [ 'customer' ];
/** * Load admin props. */ public function load_admin_details() { $this->title = __( 'Customer Opted In', 'automatewoo' ); $this->description = __( 'Fires when a customer chooses to opt-in to all workflows.', 'automatewoo' ); $this->group = __( 'Customers', 'automatewoo' ); }
/** * Register trigger hook. */ public function register_hooks() { add_action( 'automatewoo/customer/opted_in', [ $this, 'handle_opt_in' ] ); }
/** * Handle opt-in. * * @param Customer $customer */ public function handle_opt_in( $customer ) { $this->maybe_run( [ 'customer' => $customer, ] ); } }
|