PluginProbe
SellKit – Funnel builder and checkout optimizer for WooCommerce to sell more, faster / 2.7.0
SellKit – Funnel builder and checkout optimizer for WooCommerce to sell more, faster v2.7.0
2.7.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 All 43 releases
← All changes | includes/admin/class-steps.php +63 -6 1.7.52.7.0 View file →
@@ -60,8 +60,10 @@
60 60 add_action( 'wp_ajax_sellkit_steps_get_coupons', [ $this, 'get_coupons' ] );
61 61 add_action( 'wp_loaded', [ $this, 'sellkit_steps_flush_rules' ] );
62 62 add_action( 'sellkit_after_toggle_status_sellkit-funnels', [ $this, 'update_steps_post_status' ], 10, 2 );
63 63 add_action( 'sellkit_funnels_after_delete_posts_sellkit-funnels', [ $this, 'remove_steps_pages' ], 10, 1 );
64 +
65 + add_action( 'wp_loaded', [ $this, 'sellkit_set_sellkit_translation_mode' ] );
64 66 }
65 67
66 68 /**
67 69 * Removes steps pages.
@@ -77,9 +79,11 @@
77 79 return;
78 80 }
79 81
80 82 foreach ( $nodes[0] as $node ) {
81 - wp_delete_post( $node['page_id'] );
83 + if ( isset( $node['page_id'] ) ) {
84 + wp_delete_post( $node['page_id'] );
85 + }
82 86 }
83 87 }
84 88
85 89 /**
@@ -91,12 +95,12 @@
91 95 return [
92 96 'sales-page' => esc_html__( 'Sales Page', 'sellkit' ),
93 97 'checkout' => esc_html__( 'Checkout', 'sellkit' ),
94 98 'thankyou' => esc_html__( 'Thank You', 'sellkit' ),
95 - 'decision' => esc_html__( 'Decision', 'sellkit' ),
99 + 'decision' => esc_html__( 'Condition', 'sellkit' ),
96 100 'upsell' => esc_html__( 'Upsell', 'sellkit' ),
97 101 'downsell' => esc_html__( 'Downsell', 'sellkit' ),
98 - 'optin-confirmation' => esc_html__( 'Opt-in Confirmation' ),
102 + 'optin-confirmation' => esc_html__( 'Opt-in Confirmation', 'sellkit' ),
99 103 'optin' => esc_html__( 'Opt-in', 'sellkit' ),
100 104 ];
101 105 }
102 106
@@ -112,8 +116,14 @@
112 116 $step['funnel_id'] = $funnel_id;
113 117 $step['number'] = $step_number;
114 118
115 119 if ( array_key_exists( 'page_id', $step ) ) {
120 + $translated_step = apply_filters( 'wpml_object_id', $step['page_id'], 'sellkit_step', true ); // phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedHooknameFound -- WPML API.
121 +
122 + if ( $step['page_id'] !== $translated_step ) {
123 + update_post_meta( $translated_step, 'step_data', $step );
124 + }
125 +
116 126 update_post_meta( $step['page_id'], 'step_data', $step );
117 127 }
118 128 }
119 129 }
@@ -215,9 +225,9 @@
215 225 wp_send_json_error( __( 'Please install and activate WooCommerce.', 'sellkit' ) );
216 226 }
217 227
218 228 if ( empty( $products_id ) ) {
219 - wp_send_json_error( __( 'Please send some product ids' ) );
229 + wp_send_json_error( __( 'Please send some product ids', 'sellkit' ) );
220 230 }
221 231
222 232 $products_id = is_array( $products_id ) ? $products_id : [ $products_id ];
223 233
@@ -227,8 +237,14 @@
227 237 if ( empty( $product ) ) {
228 238 continue;
229 239 }
230 240
241 + $data = $product->get_data();
242 +
243 + if ( 'trash' === $data['status'] ) {
244 + continue;
245 + }
246 +
231 247 $attributes = $product->get_attributes();
232 248 $label = $product->get_title();
233 249
234 250 if ( $product->get_type() === 'variation' ) {
@@ -311,9 +327,9 @@
311 327 $nodes[ end( $old_node_keys ) + 1 ] = $last_node;
312 328 $keys = array_keys( $nodes );
313 329
314 330 if (
315 - 'last-node' !== $origin_node &&
331 + 'last-node' !== $origin_node && ! empty( $nodes[ $origin_node ] ) &&
316 332 'decision' !== $nodes[ $origin_node ]['type']['key'] &&
317 333 'upsell' !== $nodes[ $origin_node ]['type']['key'] &&
318 334 'downsell' !== $nodes[ $origin_node ]['type']['key']
319 335 ) {
@@ -320,9 +336,9 @@
320 336 $nodes[ $origin_node ]['targets'] = [ [ 'nodeId' => strval( end( $keys ) ) ] ];
321 337 }
322 338
323 339 if (
324 - 'last-node' !== $origin_node &&
340 + 'last-node' !== $origin_node && isset( $nodes[ $origin_node ]['type'] ) &&
325 341 (
326 342 'decision' === $nodes[ $origin_node ]['type']['key'] ||
327 343 'upsell' === $nodes[ $origin_node ]['type']['key'] ||
328 344 'downsell' === $nodes[ $origin_node ]['type']['key']
@@ -376,8 +392,12 @@
376 392 if ( 'string' !== gettype( $template ) || ! is_object( $post ) || self::SELLKIT_STEP_POST_TYPE !== $post->post_type ) {
377 393 return $template;
378 394 }
379 395
396 + if ( has_blocks( $post ) ) {
397 + return $template;
398 + }
399 +
380 400 remove_action( 'wp_head', 'adjacent_posts_rel_link_wp_head' );
381 401 add_filter( 'next_post_rel_link', '__return_empty_string' );
382 402 add_filter( 'previous_post_rel_link', '__return_empty_string' );
383 403
@@ -501,8 +521,12 @@
501 521 */
502 522 public function update_steps_post_status( $funnel_id, $new_status ) {
503 523 $steps = get_post_meta( $funnel_id, 'sellkit_steps', true );
504 524
525 + if ( ! is_array( $steps ) ) {
526 + return;
527 + }
528 +
505 529 foreach ( $steps as $step ) {
506 530 if ( $step['page_id'] === $funnel_id ) {
507 531 continue;
508 532 }
@@ -510,8 +534,41 @@
510 534 wp_update_post(array(
511 535 'ID' => $step['page_id'],
512 536 'post_status' => $new_status,
513 537 ) );
538 + }
539 + }
540 +
541 + /**
542 + * Make SellKit custom post types translatable by default and set step_data custom field to "Copy".
543 + *
544 + * @since 2.3.2
545 + */
546 + public function sellkit_set_sellkit_translation_mode() {
547 + if ( function_exists( 'wpml_load_settings_helper' ) ) {
548 + global $sitepress;
549 +
550 + if ( $sitepress instanceof SitePress ) {
551 + $settings_helper = wpml_load_settings_helper();
552 +
553 + $post_types = [
554 + 'sellkit_step',
555 + 'sellkit-discount',
556 + 'sellkit-coupon',
557 + 'sellkit-alert',
558 + ];
559 +
560 + foreach ( $post_types as $post_type ) {
561 + $settings_helper->set_post_type_translatable( $post_type );
562 + $settings_helper->set_post_type_translation_unlocked_option( $post_type, true );
563 +
564 + if ( class_exists( '\WPML\Settings\PostType\Automatic' ) ) {
565 + \WPML\Settings\PostType\Automatic::set( $post_type, true );
566 + }
567 + }
568 +
569 + do_action( 'wpml_save_custom_field_translation_option', 'step_data', WPML_COPY_CUSTOM_FIELD ); // phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedHooknameFound -- WPML API.
570 + }
514 571 }
515 572 }
516 573 }
517 574