WC_PURCHPROD_DEP::define_trigger()
Define and register the trigger by pushing it into the Automator object
Source Source
File: src/integrations/woocommerce/triggers/wc-purchprod-dep.php
public function define_trigger() { $options = Automator()->helpers->recipe->woocommerce->options->all_wc_products( esc_attr__( 'Product', 'uncanny-automator' ) ); $options['options'] = array( '-1' => esc_attr__( 'Any product', 'uncanny-automator' ) ) + $options['options']; $trigger = array( 'author' => Automator()->get_author_name( $this->trigger_code ), 'support_link' => Automator()->get_author_support_link( $this->trigger_code, 'integration/woocommerce/' ), 'integration' => self::$integration, 'code' => $this->trigger_code, 'is_deprecated' => true, /* translators: Logged-in trigger - WooCommerce */ 'sentence' => sprintf( esc_attr__( 'A user purchases {{a product:%1$s}} {{a number of:%2$s}} time(s)', 'uncanny-automator' ), $this->trigger_meta, 'NUMTIMES' ), /* translators: Logged-in trigger - WooCommerce */ 'select_option_name' => esc_attr__( 'A user purchases {{a product}}', 'uncanny-automator' ), 'action' => [ 'woocommerce_order_status_completed', 'woocommerce_thankyou', 'woocommerce_payment_complete', ], 'priority' => 99, 'accepted_args' => 1, 'validation_function' => array( $this, 'payment_completed' ), 'options' => [ Automator()->helpers->recipe->options->number_of_times(), $options, ], ); Automator()->register->trigger( $trigger ); return; }
Expand full source code Collapse full source code View on Github