PluginProbe ʕ •ᴥ•ʔ
ShopEngine Elementor WooCommerce Builder Addon – All in One WooCommerce Solution / 4.7.2
ShopEngine Elementor WooCommerce Builder Addon – All in One WooCommerce Solution v4.7.2
4.9.2 4.9.1 4.9.0 2.0.0 2.1.0 2.2.0 2.2.1 2.2.2 2.3.0 2.4.0 2.5.0 2.5.1 3.0.0 3.1.0 3.1.1 4.0.0 4.0.1 4.1.0 4.1.1 4.2.0 4.2.1 4.3.0 4.3.1 4.4.0 4.5.0 4.5.1 4.6.0 4.6.1 4.6.2 4.6.3 4.6.4 4.6.5 4.6.6 4.6.7 4.6.8 4.6.9 4.7.0 4.7.1 4.7.2 4.7.3 4.7.4 4.7.5 4.7.6 4.7.7 4.7.8 4.7.9 4.8.0 4.8.1 4.8.2 4.8.3 4.8.4 4.8.5 4.8.6 4.8.7 4.8.8 4.8.9 trunk 0.1.2-beta 0.1.3-beta 0.1.4-beta 1.0.0 1.1.0 1.1.1 1.1.2 1.1.3 1.2.0 1.2.1 1.3.0 1.3.1 1.3.2 1.3.3 1.3.4 1.4.0 1.4.1 1.5.0 1.5.1 1.6.0 1.6.1 1.7.0 1.8.0 1.8.1 1.9.0
shopengine / compatibility / migrations / direct-checkout.php
shopengine / compatibility / migrations Last commit date
direct-checkout.php 3 years ago lang-migration.php 3 years ago migration.php 4 years ago temp-migration.php 4 years ago
direct-checkout.php
79 lines
1 <?php
2
3 namespace ShopEngine\Compatibility\Migrations;
4
5 defined( 'ABSPATH' ) || exit;
6
7 use ShopEngine\Core\Builders\Action;
8 use ShopEngine\Core\Template_Cpt;
9
10 /**
11 * This migrate is run to push the direct checkout button item inside the archive product widget
12 * @since 3.0.1
13 */
14 class Direct_Checkout
15 {
16 public function __construct()
17 {
18 $is_run_direct_checkout_migration = get_option( 'shopengine_direct_checkout_migration' );
19 if ( !$is_run_direct_checkout_migration ) {
20 $args = [
21 'post_type' => Template_Cpt::TYPE,
22 'post_status' => ['publish', 'draft', 'trash'],
23 'posts_per_page' => -1,
24 'meta_query' => [
25 [
26 'key' => Action::get_meta_key_for_type(),
27 'value' => ['shop', 'archive'],
28 'compare' => 'IN'
29 ]
30 ]
31 ];
32
33 $wp_query = new \WP_Query( $args );
34 $templates = $wp_query->posts;
35
36 $direct_checkout = (object) [
37 'list_title' => 'Direct Checkout (PRO)',
38 'list_key' => 'direct-checkout',
39 '_id' => '9c46638'
40 ];
41
42 foreach ( $templates as $template ) {
43 $elementor_json = get_post_meta( $template->ID, '_elementor_data', true );
44 if ( !empty( $elementor_json ) ) {
45 $elementor_demo_array = json_decode( $elementor_json );
46 foreach ( $elementor_demo_array as $section_key => $section ) {
47 foreach ( $section->elements as $column_key => $column ) {
48 foreach ( $column->elements as $widget_key => $widget ) {
49 if ( isset( $widget->widgetType ) && 'shopengine-archive-products' === $widget->widgetType ) {
50
51
52 // Return if the settings not found
53 if(!isset($widget->settings->shopengine_custom_ordering_list)) return;
54
55 /**
56 * Convert std object to array
57 */
58 $button_items = json_decode( json_encode( $widget->settings->shopengine_custom_ordering_list ), true );
59
60 /**
61 * Check if direct checkout doesn't already exist
62 */
63 if ( !is_int( array_search( 'direct-checkout', array_column( $button_items, 'list_key' ) ) ) ) {
64 array_push( $elementor_demo_array[$section_key]->elements[$column_key]->elements[$widget_key]->settings->shopengine_custom_ordering_list, $direct_checkout );
65 }
66
67
68 }
69 }
70 }
71 }
72 update_post_meta( $template->ID, '_elementor_data', json_encode( $elementor_demo_array ) );
73 }
74 }
75 update_option( 'shopengine_direct_checkout_migration', true );
76 }
77 }
78 }
79