/var/www/html_uk/wp-content/plugins/automatewoo/includes/Triggers/Customer_Opted_Out.php


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_Out
 */
class Trigger_Customer_Opted_Out 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 Out''automatewoo' );
        
$this->description __'Fires when a customer chooses to opt-out from all workflows.''automatewoo' );
        
$this->group       __'Customers''automatewoo' );
    }

    
/**
     * Register trigger hook.
     */
    
public function register_hooks() {
        
add_action'automatewoo/customer/opted_out', [ $this'handle_opt_out' ] );
    }

    
/**
     * Handle opt-out.
     *
     * @param Customer $customer
     */
    
public function handle_opt_out$customer ) {
        
$this->maybe_run(
            [
                
'customer' => $customer,
            ]
        );
    }
}