PluginProbe
SellKit – Funnel builder and checkout optimizer for WooCommerce to sell more, faster / trunk
SellKit – Funnel builder and checkout optimizer for WooCommerce to sell more, faster vtrunk
2.6.0 trunk 1.1.0 1.1.4 1.2.1 1.2.2 1.2.3 1.2.5 1.2.9 1.3.1 1.3.2 1.5.0 1.5.1 1.5.4 1.5.7 1.5.8 1.5.9 1.6.2 1.6.5 1.6.8 1.7.2 1.7.4 1.7.5 1.7.9 1.8.1 All 42 releases
sellkit / includes / funnel / steps / decision.php

decision.php in SellKit – Funnel builder and checkout optimizer for WooCommerce to sell more, faster trunk, at includes/funnel/steps/decision.php

65 lines 1.4 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 namespace Sellkit\Funnel\Steps;
4
5 use Sellkit_Funnel;
6
7 defined( 'ABSPATH' ) || die();
8
9 /**
10 * Class Decision.
11 *
12 * @since 1.5.0
13 */
14 class Decision {
15 /**
16 * Current funnel.
17 *
18 * @since 1.8.6
19 * @var Sellkit_Funnel
20 */
21 public $funnel;
22
23 /**
24 * Decision constructor.
25 *
26 * @since 1.5.0
27 */
28 public function __construct() {
29 $this->funnel = Sellkit_Funnel::get_instance();
30
31 }
32
33 /**
34 * Upsell actions.
35 *
36 * @since 1.1.0
37 * @SuppressWarnings(PHPMD.NPathComplexity)
38 */
39 public function do_actions() {
40 $conditions = ! empty( $this->funnel->current_step_data['data']['conditions'] ) ? $this->funnel->current_step_data['data']['conditions'] : [];
41
42 $is_valid = sellkit_conditions_validation( $conditions );
43
44 $args = [];
45
46 if ( ! empty( $_GET['order-key'] ) ) { // phpcs:ignore
47 $args['order-key'] = $_GET['order-key']; // phpcs:ignore
48 }
49
50 if ( $is_valid && ! empty( $this->funnel->next_step_data['page_id'] ) ) {
51 wp_safe_redirect( add_query_arg( $args, get_permalink( $this->funnel->next_step_data['page_id'] ) ) );
52 return;
53 }
54
55 if ( ! $is_valid && ! empty( $this->funnel->next_no_step_data['page_id'] ) ) {
56 wp_safe_redirect( add_query_arg( $args, get_permalink( $this->funnel->next_no_step_data['page_id'] ) ) );
57 return;
58 }
59
60 if ( ! empty( $this->funnel->end_node_step_data['page_id'] ) ) {
61 wp_safe_redirect( add_query_arg( $args, get_permalink( $this->funnel->end_node_step_data['page_id'] ) ) );
62 }
63 }
64 }
65