PluginProbe
SellKit – Funnel builder and checkout optimizer for WooCommerce to sell more, faster / 1.6.2
SellKit – Funnel builder and checkout optimizer for WooCommerce to sell more, faster v1.6.2
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 1.6.2, at includes/funnel/steps/decision.php

58 lines 1.3 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 /**
17 * Decision constructor.
18 *
19 * @since 1.5.0
20 */
21 public function __construct() {
22 $this->funnel = Sellkit_Funnel::get_instance();
23
24 }
25
26 /**
27 * Upsell actions.
28 *
29 * @since 1.1.0
30 * @SuppressWarnings(PHPMD.NPathComplexity)
31 */
32 public function do_actions() {
33 $conditions = ! empty( $this->funnel->current_step_data['data']['conditions'] ) ? $this->funnel->current_step_data['data']['conditions'] : [];
34
35 $is_valid = sellkit_conditions_validation( $conditions );
36
37 $args = [];
38
39 if ( ! empty( $_GET['order-key'] ) ) { // phpcs:ignore
40 $args['order-key'] = $_GET['order-key']; // phpcs:ignore
41 }
42
43 if ( $is_valid && ! empty( $this->funnel->next_step_data['page_id'] ) ) {
44 wp_safe_redirect( add_query_arg( $args, get_permalink( $this->funnel->next_step_data['page_id'] ) ) );
45 return;
46 }
47
48 if ( ! $is_valid && ! empty( $this->funnel->next_no_step_data['page_id'] ) ) {
49 wp_safe_redirect( add_query_arg( $args, get_permalink( $this->funnel->next_no_step_data['page_id'] ) ) );
50 return;
51 }
52
53 if ( ! empty( $this->funnel->end_node_step_data['page_id'] ) ) {
54 wp_safe_redirect( add_query_arg( $args, get_permalink( $this->funnel->end_node_step_data['page_id'] ) ) );
55 }
56 }
57 }
58