Pixel Manager for WooCommerce – Track Google Analytics, Google Ads, Facebook and more - Version 1.17.1

Version Description

12.05.2022

  • Tweak: Adjusted db query for clv order total
Download this release

Release Info

Developer alekv
Plugin Icon 128x128 Pixel Manager for WooCommerce – Track Google Analytics, Google Ads, Facebook and more
Version 1.17.1
Comparing to
See all releases

Code changes from version 1.17.0 to 1.17.1

Files changed (3) hide show
  1. classes/pixels/trait-shop.php +6 -7
  2. readme.txt +5 -1
  3. wgact.php +2 -2
classes/pixels/trait-shop.php CHANGED
@@ -208,13 +208,12 @@ trait Trait_Shop
208
  // https://github.com/woocommerce/woocommerce/blob/5d7f6acbcb387f1d51d51305bf949d07fa3c4b08/includes/data-stores/class-wc-customer-data-store.php#L401
209
  protected function get_clv_order_total_by_billing_email( $billing_email )
210
  {
211
- global $wpdb ;
212
- $statuses = array_map( 'esc_sql', wc_get_is_paid_statuses() );
213
- $spent = $wpdb->get_var(
214
- // phpcs:disable WordPress.DB.PreparedSQL.NotPrepared
215
- "SELECT SUM(meta2.meta_value)\n\t\t\t\t\tFROM {$wpdb->posts} as posts\n\t\t\t\t\tLEFT JOIN {$wpdb->postmeta} AS meta ON posts.ID = meta.post_id\n\t\t\t\t\tLEFT JOIN {$wpdb->postmeta} AS meta2 ON posts.ID = meta2.post_id\n\t\t\t\t\tWHERE meta.meta_key = '_billing_email'\n\t\t\t\t\tAND meta.meta_value = '" . esc_sql( sanitize_email( $billing_email ) ) . "'\n\t\t\t\t\tAND posts.post_type = 'shop_order'\n\t\t\t\t\tAND posts.post_status IN ( 'wc-" . implode( "','wc-", $statuses ) . "' )\n\t\t\t\t\tAND meta2.meta_key = '_order_total'"
216
- );
217
- return $spent;
218
  }
219
 
220
  protected function get_clv_value_filtered_by_billing_email( $billing_email )
208
  // https://github.com/woocommerce/woocommerce/blob/5d7f6acbcb387f1d51d51305bf949d07fa3c4b08/includes/data-stores/class-wc-customer-data-store.php#L401
209
  protected function get_clv_order_total_by_billing_email( $billing_email )
210
  {
211
+ $orders = $this->get_all_paid_orders_by_billing_email( $billing_email );
212
+ $value = 0;
213
+ foreach ( $orders as $order ) {
214
+ $value += $order->get_total();
215
+ }
216
+ return wc_format_decimal( $value, 2 );
 
217
  }
218
 
219
  protected function get_clv_value_filtered_by_billing_email( $billing_email )
readme.txt CHANGED
@@ -4,7 +4,7 @@ Tags: woocommerce, google ads, google analytics, facebook pixel, conversion trac
4
  Requires at least: 3.7
5
  Tested up to: 5.9
6
  Requires PHP: 7.3
7
- Stable tag: 1.17.0
8
  License: GPLv3 or later
9
  License URI: http://www.gnu.org/licenses/gpl-3.0.html
10
 
@@ -186,6 +186,10 @@ You can send the link to the front page of your shop too if you think it would b
186
 
187
  == Changelog ==
188
 
 
 
 
 
189
  = 1.17.0 = 12.05.2022
190
 
191
 
4
  Requires at least: 3.7
5
  Tested up to: 5.9
6
  Requires PHP: 7.3
7
+ Stable tag: 1.17.1
8
  License: GPLv3 or later
9
  License URI: http://www.gnu.org/licenses/gpl-3.0.html
10
 
186
 
187
  == Changelog ==
188
 
189
+ = 1.17.1 = 12.05.2022
190
+
191
+ * Tweak: Adjusted db query for clv order total
192
+
193
  = 1.17.0 = 12.05.2022
194
 
195
 
wgact.php CHANGED
@@ -10,7 +10,7 @@
10
  * Developer URI: https://sweetcode.com
11
  * Text Domain: woocommerce-google-adwords-conversion-tracking-tag
12
  * Domain path: /languages
13
- * * Version: 1.17.0
14
  *
15
  * WC requires at least: 3.7
16
  * WC tested up to: 6.4
@@ -20,7 +20,7 @@
20
  *
21
  *
22
  **/
23
- const WPM_CURRENT_VERSION = '1.17.0' ;
24
  // TODO export settings function
25
  // TODO add option checkbox on uninstall and ask if user wants to delete options from db
26
 
10
  * Developer URI: https://sweetcode.com
11
  * Text Domain: woocommerce-google-adwords-conversion-tracking-tag
12
  * Domain path: /languages
13
+ * * Version: 1.17.1
14
  *
15
  * WC requires at least: 3.7
16
  * WC tested up to: 6.4
20
  *
21
  *
22
  **/
23
+ const WPM_CURRENT_VERSION = '1.17.1' ;
24
  // TODO export settings function
25
  // TODO add option checkbox on uninstall and ask if user wants to delete options from db
26