PluginProbe
SellKit – Funnel builder and checkout optimizer for WooCommerce to sell more, faster / 2.3.0
SellKit – Funnel builder and checkout optimizer for WooCommerce to sell more, faster v2.3.0
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
← All changes | includes/admin/class-posts.php +23 -5 1.7.92.3.0 View file →
@@ -136,13 +136,17 @@
136 136 $post_data['sellkit_post_slug'] = get_post_field( 'post_name', $post_id );
137 137 $post_data['sellkit_post_status'] = get_post_status( $post_id );
138 138
139 139 // Unset sales-page when user exploring global checkout page.
140 - if ( 'checkout' === $page ) {
140 + if ( 'checkout' === $page && ! empty( $post_data['nodes'] ) ) {
141 141 foreach ( $post_data['nodes'] as $key => $step ) {
142 - if ( 'sales-page' === $step['type']->key ) {
142 + if ( is_array( $step['type'] ) && 'sales-page' === $step['type']['key'] ) {
143 143 unset( $post_data['nodes']->$key );
144 144 }
145 +
146 + if ( is_object( $step['type'] ) && 'sales-page' === $step['type']->key ) {
147 + unset( $post_data['nodes']->$key );
148 + }
145 149 }
146 150 }
147 151
148 152 wp_send_json_success( [ 'post_data' => $post_data ] );
@@ -157,9 +161,11 @@
157 161 public static function convert_steps_to_nodes( $steps ) {
158 162 $nodes = [];
159 163 $final_steps = $steps;
160 164
161 - if ( empty( $steps[0]['targets'] ) ) {
165 + $first_key = array_key_first( $steps );
166 +
167 + if ( empty( $steps[ $first_key ]['targets'] ) ) {
162 168 $final_steps = self::add_decision_node_before_upsells( $steps );
163 169 }
164 170
165 171 foreach ( $final_steps as $key => $step ) {
@@ -215,9 +221,9 @@
215 221 $upsell_num = 0;
216 222
217 223 foreach ( $steps as $key => $step ) {
218 224 $step['type'] = (object) $step['type'];
219 - $step['data'] = (object) $step['data'];
225 + $step['data'] = ! empty( $step['data'] ) ? (object) $step['data'] : null;
220 226
221 227 if ( ! empty( $step['type']->key ) && 'upsell' === $step['type']->key ) {
222 228 $new_node_id = wp_insert_post( [
223 229 'post_type' => Sellkit_Admin_Steps::SELLKIT_STEP_POST_TYPE,
@@ -315,8 +321,12 @@
315 321 $title = sanitize_text_field( $data['sellkit_post_title'] );
316 322 $slug = ! empty( $data['sellkit_post_slug'] ) ? sanitize_text_field( $data['sellkit_post_slug'] ) : '';
317 323 $post_status = 'publish' === $data['sellkit_post_status'] ? 'publish' : 'draft';
318 324
325 + if ( isset( $data['sellkit_global_checkout_header_footer_templates'] ) && 'checkout' === $this->page ) {
326 + unset( $data['sellkit_global_checkout_header_footer_templates'] );
327 + }
328 +
319 329 $post_args = [
320 330 'post_title' => $title,
321 331 'post_name' => $slug ?: sanitize_title( $title ),
322 332 'post_type' => $post_type,
@@ -436,15 +446,23 @@
436 446 public function check_product_status( $nodes ) {
437 447 $nodes = (object) unserialize( $nodes ); // phpcs:ignore WordPress.PHP
438 448 $new_node = [];
439 449
450 + if ( ! class_exists( 'WooCommerce' ) ) {
451 + return $new_node;
452 + }
453 +
440 454 foreach ( $nodes as $index => $node ) {
455 + if ( ! empty( $node['page_id'] ) ) {
456 + $node['link'] = get_the_permalink( $node['page_id'] );
457 + }
458 +
441 459 if ( 'checkout' !== $node['type']['key'] ) {
442 460 $new_node[ $index ] = $node;
443 461 continue;
444 462 }
445 463
446 - if ( ! empty( $node['data']['products'] ) ) {
464 + if ( ! empty( $node['data']['products'] ) && ! empty( $node['data']['products']['list'] ) ) {
447 465 foreach ( $node['data']['products']['list'] as $key => $product ) {
448 466 $product_obj = wc_get_product( $key );
449 467
450 468 if ( empty( $product_obj ) ) {