PixelYourSite – Facebook Pixel (Events, WooCommerce & Easy Digital Downloads) - Version 7.1.12

Version Description

Download this release

Release Info

Developer PixelYourSite
Plugin Icon 128x128 PixelYourSite – Facebook Pixel (Events, WooCommerce & Easy Digital Downloads)
Version 7.1.12
Comparing to
See all releases

Code changes from version 7.1.11 to 7.1.12

facebook-pixel-master.php CHANGED
@@ -4,7 +4,7 @@
4
  * Plugin Name: PixelYourSite
5
  * Plugin URI: http://www.pixelyoursite.com/
6
  * Description: No codding <strong>Facebook Pixel</strong> and <strong>Google Analytics</strong> install. Track key actions with our Global Events, or configure your own events. WooCommerce and EDD fully supported, with Facebook Dynamic Ads Pixel set-up and Google Analytics Enhanced Ecommerce. Insert any custom script with our Head & Footer option. Add the <strong>Pinterest Tag</strong> with our free add-on. The PRO version adds support for the Google Ads tag plus a lot of extra stuff.
7
- * Version: 7.1.11
8
  * Author: PixelYourSite
9
  * Author URI: http://www.pixelyoursite.com
10
  * License: GPLv3
@@ -13,7 +13,7 @@
13
  * Tested up to: 5.4
14
  *
15
  * WC requires at least: 2.6.0
16
- * WC tested up to: 4.3
17
  *
18
  * Text Domain: pys
19
  */
4
  * Plugin Name: PixelYourSite
5
  * Plugin URI: http://www.pixelyoursite.com/
6
  * Description: No codding <strong>Facebook Pixel</strong> and <strong>Google Analytics</strong> install. Track key actions with our Global Events, or configure your own events. WooCommerce and EDD fully supported, with Facebook Dynamic Ads Pixel set-up and Google Analytics Enhanced Ecommerce. Insert any custom script with our Head & Footer option. Add the <strong>Pinterest Tag</strong> with our free add-on. The PRO version adds support for the Google Ads tag plus a lot of extra stuff.
7
+ * Version: 7.1.12
8
  * Author: PixelYourSite
9
  * Author URI: http://www.pixelyoursite.com
10
  * License: GPLv3
13
  * Tested up to: 5.4
14
  *
15
  * WC requires at least: 2.6.0
16
+ * WC tested up to: 4.4
17
  *
18
  * Text Domain: pys
19
  */
includes/class-events-manager.php CHANGED
@@ -719,10 +719,10 @@ class EventsManager {
719
 
720
  $payment_key = getEddPaymentKey();
721
  $order_id = (int) edd_get_purchase_id_by_key( $payment_key );
722
- $status = edd_get_payment_status( $order_id, true );
723
 
724
  // pending payment status used because we can't fire event on IPN
725
- if ( strtolower( $status ) != 'complete' && strtolower( $status ) != 'pending' ) {
726
  return;
727
  }
728
 
719
 
720
  $payment_key = getEddPaymentKey();
721
  $order_id = (int) edd_get_purchase_id_by_key( $payment_key );
722
+ $status = edd_get_payment_status( $order_id );
723
 
724
  // pending payment status used because we can't fire event on IPN
725
+ if ( strtolower( $status ) != 'publish' && strtolower( $status ) != 'pending' ) {
726
  return;
727
  }
728
 
includes/functions-common.php CHANGED
@@ -205,39 +205,43 @@ function getAvailableUserRoles() {
205
 
206
  }
207
 
208
- function getAvailableProductCog($product_id) {
209
 
210
- $parent_id = wp_get_post_parent_id( $product_id );
211
- $cog_product_val = get_post_meta( $product_id, '_pixel_cost_of_goods_cost_val', true );
212
- $cog_term_val = get_product_cost_by_cat( $product_id );
213
- if (($parent_id > 0) && $cog_product_val == '') {
214
- $cog_product_val = get_post_meta( $parent_id, '_pixel_cost_of_goods_cost_val', true );
215
- }
216
- if ($cog_product_val) {
217
- $cog = array(
218
- 'type' => get_post_meta( $product_id, '_pixel_cost_of_goods_cost_type', true ),
219
- 'val' => $cog_product_val
220
- );
221
- } elseif ($cog_term_val) {
222
- $cog = array(
223
- 'type' => get_product_type_by_cat( $product_id ),
224
- 'val' => $cog_term_val
225
- );
226
- } else {
227
- $cog = array(
228
- 'type' => get_option( '_pixel_cost_of_goods_cost_type'),
229
- 'val' => get_option( '_pixel_cost_of_goods_cost_val')
230
- );
231
- }
 
 
 
 
 
 
232
 
233
- return $cog;
234
 
235
  }
236
 
237
  function getAvailableProductCogOrder($order) {
238
-
239
  $cost = 0;
240
- $notice = '';
241
  $custom_total = 0;
242
  $cat_isset = 0;
243
  $isWithoutTax = get_option( '_pixel_cog_tax_calculating') == 'no';
@@ -253,10 +257,18 @@ function getAvailableProductCogOrder($order) {
253
 
254
  foreach ( $order->get_items() as $item_id => $item ) {
255
  $product_id = ( isset( $item['variation_id'] ) && 0 != $item['variation_id'] ? $item['variation_id'] : $item['product_id'] );
256
- $cost_type = get_post_meta( $product_id, '_pixel_cost_of_goods_cost_type', true );
257
- $product_cost = get_post_meta( $product_id, '_pixel_cost_of_goods_cost_val', true );
258
-
259
  $product = wc_get_product($product_id);
 
 
 
 
 
 
 
 
 
 
 
260
  $args = array( 'qty' => 1, 'price' => $product->get_price());
261
  $qlt = $item['quantity'];
262
 
@@ -318,10 +330,17 @@ function getAvailableProductCogCart() {
318
 
319
  foreach ( WC()->cart->cart_contents as $cart_item_key => $item ) {
320
  $product_id = ( isset( $item['variation_id'] ) && 0 != $item['variation_id'] ? $item['variation_id'] : $item['product_id'] );
321
- $cost_type = get_post_meta( $product_id, '_pixel_cost_of_goods_cost_type', true );
322
 
323
  $product = wc_get_product($product_id);
324
 
 
 
 
 
 
 
 
 
325
  $args = array( 'qty' => 1, 'price' => $product->get_price());
326
  if($isWithoutTax) {
327
  $price = wc_get_price_excluding_tax($product, $args);
@@ -331,9 +350,6 @@ function getAvailableProductCogCart() {
331
  $qlt = $item['quantity'];
332
 
333
 
334
- $product_cost = get_post_meta( $product_id, '_pixel_cost_of_goods_cost_val', true );
335
-
336
-
337
  if ($product_cost) {
338
  $cost = ($cost_type == 'percent') ? $cost + ($price * ($product_cost / 100) * $qlt) : $cost + ($product_cost * $qlt);
339
  $custom_total = $custom_total + ($price * $qlt);
205
 
206
  }
207
 
208
+ function getAvailableProductCog($product) {
209
 
210
+ $cost_type = get_post_meta( $product->get_id(), '_pixel_cost_of_goods_cost_type', true );
211
+ $product_cost = get_post_meta( $product->get_id(), '_pixel_cost_of_goods_cost_val', true );
212
+
213
+ if(!$product_cost && $product->is_type("variation")) {
214
+ $cost_type = get_post_meta( $product->get_parent_id(), '_pixel_cost_of_goods_cost_type', true );
215
+ $product_cost = get_post_meta( $product->get_parent_id(), '_pixel_cost_of_goods_cost_val', true );
216
+ }
217
+
218
+
219
+ if ($product_cost) {
220
+ $cog = array(
221
+ 'type' => $cost_type,
222
+ 'val' => $product_cost
223
+ );
224
+ } else {
225
+ $cog_term_val = get_product_cost_by_cat( $product->get_id() );
226
+ if ($cog_term_val) {
227
+ $cog = array(
228
+ 'type' => get_product_type_by_cat( $product->get_id() ),
229
+ 'val' => $cog_term_val
230
+ );
231
+ } else {
232
+ $cog = array(
233
+ 'type' => get_option( '_pixel_cost_of_goods_cost_type'),
234
+ 'val' => get_option( '_pixel_cost_of_goods_cost_val')
235
+ );
236
+ }
237
+ }
238
 
239
+ return $cog;
240
 
241
  }
242
 
243
  function getAvailableProductCogOrder($order) {
 
244
  $cost = 0;
 
245
  $custom_total = 0;
246
  $cat_isset = 0;
247
  $isWithoutTax = get_option( '_pixel_cog_tax_calculating') == 'no';
257
 
258
  foreach ( $order->get_items() as $item_id => $item ) {
259
  $product_id = ( isset( $item['variation_id'] ) && 0 != $item['variation_id'] ? $item['variation_id'] : $item['product_id'] );
 
 
 
260
  $product = wc_get_product($product_id);
261
+ if(!$product) continue;
262
+
263
+ $cost_type = get_post_meta( $product->get_id(), '_pixel_cost_of_goods_cost_type', true );
264
+ $product_cost = get_post_meta( $product->get_id(), '_pixel_cost_of_goods_cost_val', true );
265
+
266
+ if(!$product_cost && $product->is_type("variation")) {
267
+ $cost_type = get_post_meta( $product->get_parent_id(), '_pixel_cost_of_goods_cost_type', true );
268
+ $product_cost = get_post_meta( $product->get_parent_id(), '_pixel_cost_of_goods_cost_val', true );
269
+ }
270
+
271
+
272
  $args = array( 'qty' => 1, 'price' => $product->get_price());
273
  $qlt = $item['quantity'];
274
 
330
 
331
  foreach ( WC()->cart->cart_contents as $cart_item_key => $item ) {
332
  $product_id = ( isset( $item['variation_id'] ) && 0 != $item['variation_id'] ? $item['variation_id'] : $item['product_id'] );
 
333
 
334
  $product = wc_get_product($product_id);
335
 
336
+ $cost_type = get_post_meta( $product->get_id(), '_pixel_cost_of_goods_cost_type', true );
337
+ $product_cost = get_post_meta( $product->get_id(), '_pixel_cost_of_goods_cost_val', true );
338
+
339
+ if(!$product_cost && $product->is_type("variation")) {
340
+ $cost_type = get_post_meta( $product->get_parent_id(), '_pixel_cost_of_goods_cost_type', true );
341
+ $product_cost = get_post_meta( $product->get_parent_id(), '_pixel_cost_of_goods_cost_val', true );
342
+ }
343
+
344
  $args = array( 'qty' => 1, 'price' => $product->get_price());
345
  if($isWithoutTax) {
346
  $price = wc_get_price_excluding_tax($product, $args);
350
  $qlt = $item['quantity'];
351
 
352
 
 
 
 
353
  if ($product_cost) {
354
  $cost = ($cost_type == 'percent') ? $cost + ($price * ($product_cost / 100) * $qlt) : $cost + ($product_cost * $qlt);
355
  $custom_total = $custom_total + ($price * $qlt);
includes/functions-woo.php CHANGED
@@ -95,7 +95,7 @@ function getWooEventValue( $valueOption, $global, $percent, $product_id,$qty ) {
95
  $amount = wc_get_price_including_tax($product,$args);
96
  }
97
 
98
- $cog = getAvailableProductCog($product_id);
99
 
100
  if ($cog['val']) {
101
  if ($cog['type'] == 'fix') {
95
  $amount = wc_get_price_including_tax($product,$args);
96
  }
97
 
98
+ $cog = getAvailableProductCog($product);
99
 
100
  if ($cog['val']) {
101
  if ($cog['type'] == 'fix') {
pixelyoursite.php CHANGED
@@ -4,7 +4,7 @@ if ( ! defined( 'ABSPATH' ) ) {
4
  exit; // Exit if accessed directly.
5
  }
6
 
7
- define( 'PYS_FREE_VERSION', '7.1.11' );
8
  define( 'PYS_FREE_PINTEREST_MIN_VERSION', '2.0.6' );
9
  define( 'PYS_FREE_BING_MIN_VERSION', '1.0.0' );
10
  define( 'PYS_FREE_PATH', untrailingslashit( plugin_dir_path( __FILE__ ) ) );
4
  exit; // Exit if accessed directly.
5
  }
6
 
7
+ define( 'PYS_FREE_VERSION', '7.1.12' );
8
  define( 'PYS_FREE_PINTEREST_MIN_VERSION', '2.0.6' );
9
  define( 'PYS_FREE_BING_MIN_VERSION', '1.0.0' );
10
  define( 'PYS_FREE_PATH', untrailingslashit( plugin_dir_path( __FILE__ ) ) );
readme.txt CHANGED
@@ -4,7 +4,7 @@ Tags: Facebook Pixel, New Facebook Pixel, Facebook Conversion Pixel, Facebook Pi
4
  Requires at least: 3.0.1
5
  Requires PHP: 5.4
6
  Tested up to: 5.5
7
- Stable tag: 7.1.11
8
  License: GPLv3
9
  License URI: http://www.gnu.org/licenses/gpl-3.0.html
10
 
@@ -390,6 +390,15 @@ NO, absolutely not! We don't track any type of data about your website. We simpl
390
 
391
  == Changelog ==
392
 
 
 
 
 
 
 
 
 
 
393
 
394
  = PixelYourSite 7.1.11 =
395
 
4
  Requires at least: 3.0.1
5
  Requires PHP: 5.4
6
  Tested up to: 5.5
7
+ Stable tag: 7.1.12
8
  License: GPLv3
9
  License URI: http://www.gnu.org/licenses/gpl-3.0.html
10
 
390
 
391
  == Changelog ==
392
 
393
+ = PixelYourSite 7.1.12 =
394
+
395
+ * FIX: Possible issue with Easy Digital Download Purchase Event.
396
+
397
+ * FIX: Possible issue with [Cost of Goods](https://www.pixelyoursite.com/plugins/woocommerce-cost-of-goods) values for variable products.
398
+
399
+ * WooCommerce 4.4 compatibility check.
400
+
401
+
402
 
403
  = PixelYourSite 7.1.11 =
404