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/settings/integration/google-integration.php +8 -2 1.2.22.7.0 View file →
@@ -72,9 +72,9 @@
72 72 // phpcs:enable
73 73
74 74 $google_script .= $this->google_analytics_events( self::$post, $google_tracking_id );
75 75
76 - echo $google_script;
76 + echo $google_script; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- Inline analytics script; tracking IDs escaped with esc_js.
77 77 }
78 78
79 79 /**
80 80 * Get google analyticts events scripts.
@@ -89,9 +89,11 @@
89 89 if ( empty( $google_events ) ) {
90 90 return;
91 91 }
92 92
93 - $sellkit_page_meta = $post_meta[0]['type']['key'];
93 + $first_index = array_key_first( $post_meta );
94 +
95 + $sellkit_page_meta = $post_meta[ $first_index ]['type']['key'];
94 96 $google_events_script = '';
95 97
96 98 foreach ( $google_events as $event ) {
97 99 $function_name = "google_analytics_{$event}";
@@ -231,8 +233,12 @@
231 233 * @since 1.1.0
232 234 * @param string $tracking_id Filter google tracking id.
233 235 */
234 236 private function get_cart_data( $tracking_id ) {
237 + if ( ! sellkit()->has_valid_dependencies() ) {
238 + return wp_json_encode( [] );
239 + }
240 +
235 241 $products_in_cart = WC()->cart->get_cart();
236 242 $products = [];
237 243 $cart_data = [];
238 244