Version Description
Download this release
Release Info
Developer | PixelYourSite |
Plugin | PixelYourSite – Facebook Pixel (Events, WooCommerce & Easy Digital Downloads) |
Version | 5.0.6 |
Comparing to | |
See all releases |
Code changes from version 5.0.5.2 to 5.0.6
- facebook-pixel-master.php +2 -2
- inc/common.php +10 -7
- inc/core.php +9 -7
- inc/integrations/facebook-for-woocommerce.php +48 -12
- readme.txt +7 -1
facebook-pixel-master.php
CHANGED
@@ -5,7 +5,7 @@
|
|
5 |
Plugin URI: http://www.pixelyoursite.com/facebook-pixel-plugin-help
|
6 |
Author: PixelYourSite
|
7 |
Author URI: http://www.pixelyoursite.com
|
8 |
-
Version: 5.0.
|
9 |
License: GPLv3
|
10 |
*/
|
11 |
|
@@ -13,7 +13,7 @@ if ( ! defined( 'ABSPATH' ) ) {
|
|
13 |
exit; // Exit if accessed directly.
|
14 |
}
|
15 |
|
16 |
-
define( 'PYS_FREE_VERSION', '5.0.
|
17 |
|
18 |
if ( ! function_exists( 'pys_is_pixelyoursite_pro_active' ) ) {
|
19 |
|
5 |
Plugin URI: http://www.pixelyoursite.com/facebook-pixel-plugin-help
|
6 |
Author: PixelYourSite
|
7 |
Author URI: http://www.pixelyoursite.com
|
8 |
+
Version: 5.0.6
|
9 |
License: GPLv3
|
10 |
*/
|
11 |
|
13 |
exit; // Exit if accessed directly.
|
14 |
}
|
15 |
|
16 |
+
define( 'PYS_FREE_VERSION', '5.0.6' );
|
17 |
|
18 |
if ( ! function_exists( 'pys_is_pixelyoursite_pro_active' ) ) {
|
19 |
|
inc/common.php
CHANGED
@@ -433,20 +433,23 @@ if ( ! function_exists( 'pys_get_product_content_id' ) ) {
|
|
433 |
|
434 |
}
|
435 |
|
436 |
-
if ( ! function_exists( '
|
437 |
|
438 |
/**
|
439 |
* Return main or variation product id.
|
440 |
*/
|
441 |
-
function
|
|
|
|
|
442 |
|
443 |
-
if ( pys_get_option( 'woo', 'variation_id' ) != 'main' && isset( $
|
444 |
-
|
445 |
} else {
|
446 |
-
$
|
447 |
}
|
|
|
|
|
448 |
|
449 |
-
return $id;
|
450 |
}
|
451 |
|
452 |
}
|
@@ -973,7 +976,7 @@ if( !function_exists( 'pys_get_woo_checkout_params' ) ) {
|
|
973 |
|
974 |
foreach ( $woocommerce->cart->cart_contents as $cart_item_key => $item ) {
|
975 |
|
976 |
-
$product_id =
|
977 |
$ids = array_merge( $ids, pys_get_product_content_id( $product_id ) );
|
978 |
|
979 |
// content_name, category_name for each cart item
|
433 |
|
434 |
}
|
435 |
|
436 |
+
if ( ! function_exists( 'pys_get_woo_cart_item_product_id' ) ) {
|
437 |
|
438 |
/**
|
439 |
* Return main or variation product id.
|
440 |
*/
|
441 |
+
function pys_get_woo_cart_item_product_id( $cart_item ) {
|
442 |
+
|
443 |
+
$content_id_format = pys_get_option( 'woo', 'content_id_format', 'default' );
|
444 |
|
445 |
+
if ( pys_get_option( 'woo', 'variation_id' ) != 'main' && isset( $cart_item['variation_id'] ) && $cart_item['variation_id'] !== 0 ) {
|
446 |
+
$product_id = $cart_item['variation_id'];
|
447 |
} else {
|
448 |
+
$product_id = $cart_item['product_id'];
|
449 |
}
|
450 |
+
|
451 |
+
return apply_filters( 'pys_fb_pixel_woo_cart_item_product_id', $product_id, $cart_item, $content_id_format );
|
452 |
|
|
|
453 |
}
|
454 |
|
455 |
}
|
976 |
|
977 |
foreach ( $woocommerce->cart->cart_contents as $cart_item_key => $item ) {
|
978 |
|
979 |
+
$product_id = pys_get_woo_cart_item_product_id( $item );
|
980 |
$ids = array_merge( $ids, pys_get_product_content_id( $product_id ) );
|
981 |
|
982 |
// content_name, category_name for each cart item
|
inc/core.php
CHANGED
@@ -72,17 +72,19 @@ if ( ! function_exists( 'pys_get_woo_code' ) ) {
|
|
72 |
|
73 |
$product = wc_get_product( $post->ID );
|
74 |
|
75 |
-
$params['
|
76 |
-
|
77 |
-
$params['content_ids'] = json_encode( pys_get_product_content_id( $post->ID ) );
|
78 |
|
79 |
if ( $product->get_type() == 'variable' && pys_get_option( 'woo', 'variation_id' ) != 'main' ) {
|
80 |
$params['content_type'] = 'product_group';
|
81 |
} else {
|
82 |
$params['content_type'] = 'product';
|
83 |
}
|
84 |
-
|
85 |
-
|
|
|
|
|
|
|
|
|
86 |
if ( pys_get_option( 'woo', 'enable_view_content_value' ) ) {
|
87 |
|
88 |
$option = pys_get_option( 'woo', 'view_content_value_option' );
|
@@ -117,7 +119,7 @@ if ( ! function_exists( 'pys_get_woo_code' ) ) {
|
|
117 |
|
118 |
foreach ( $woocommerce->cart->cart_contents as $cart_item_key => $item ) {
|
119 |
|
120 |
-
$product_id =
|
121 |
$ids = array_merge( $ids, pys_get_product_content_id( $product_id ) );
|
122 |
|
123 |
}
|
@@ -196,7 +198,7 @@ if ( ! function_exists( 'pys_get_woo_code' ) ) {
|
|
196 |
|
197 |
foreach ( $items as $item ) {
|
198 |
|
199 |
-
$product_id =
|
200 |
$ids = array_merge( $ids, pys_get_product_content_id( $product_id ) );
|
201 |
|
202 |
}
|
72 |
|
73 |
$product = wc_get_product( $post->ID );
|
74 |
|
75 |
+
$params['content_ids'] = json_encode( pys_get_product_content_id( $post->ID ) );
|
|
|
|
|
76 |
|
77 |
if ( $product->get_type() == 'variable' && pys_get_option( 'woo', 'variation_id' ) != 'main' ) {
|
78 |
$params['content_type'] = 'product_group';
|
79 |
} else {
|
80 |
$params['content_type'] = 'product';
|
81 |
}
|
82 |
+
|
83 |
+
// @since 5.0.6
|
84 |
+
$params['content_type'] = apply_filters( 'pys_fb_pixel_woo_product_content_type', $params['content_type'],
|
85 |
+
$product->get_type(), $product, pys_get_option( 'woo', 'content_id_format' ) );
|
86 |
+
|
87 |
+
// currency, value
|
88 |
if ( pys_get_option( 'woo', 'enable_view_content_value' ) ) {
|
89 |
|
90 |
$option = pys_get_option( 'woo', 'view_content_value_option' );
|
119 |
|
120 |
foreach ( $woocommerce->cart->cart_contents as $cart_item_key => $item ) {
|
121 |
|
122 |
+
$product_id = pys_get_woo_cart_item_product_id( $item );
|
123 |
$ids = array_merge( $ids, pys_get_product_content_id( $product_id ) );
|
124 |
|
125 |
}
|
198 |
|
199 |
foreach ( $items as $item ) {
|
200 |
|
201 |
+
$product_id = pys_get_woo_cart_item_product_id( $item );
|
202 |
$ids = array_merge( $ids, pys_get_product_content_id( $product_id ) );
|
203 |
|
204 |
}
|
inc/integrations/facebook-for-woocommerce.php
CHANGED
@@ -62,22 +62,58 @@ if ( class_exists( 'WC_Facebookcommerce' ) ) :
|
|
62 |
if( $content_id_format !== 'facebook_for_woocommerce' ) {
|
63 |
return $content_id;
|
64 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
65 |
|
66 |
-
$
|
67 |
-
|
68 |
-
|
69 |
|
70 |
-
if ( $
|
71 |
-
|
72 |
-
|
73 |
-
$
|
74 |
-
|
75 |
}
|
76 |
|
77 |
-
|
78 |
-
|
79 |
-
}
|
80 |
-
|
81 |
add_filter( 'pys_fb_pixel_setting_defaults', 'fb_for_woo_pys_fb_pixel_setting_defaults', 10, 1 );
|
82 |
function fb_for_woo_pys_fb_pixel_setting_defaults( $setting_defaults ) {
|
83 |
|
62 |
if( $content_id_format !== 'facebook_for_woocommerce' ) {
|
63 |
return $content_id;
|
64 |
}
|
65 |
+
|
66 |
+
$product = wc_get_product($product_id);
|
67 |
+
|
68 |
+
if ( ! $product ) {
|
69 |
+
return $content_id;
|
70 |
+
}
|
71 |
+
|
72 |
+
// Call $product->get_id() instead of ->id to account for Variable
|
73 |
+
// products, which have their own variant_ids.
|
74 |
+
$retailer_id = $product->get_sku() ? $product->get_sku() . '_' .
|
75 |
+
$product->get_id() : 'wc_post_id_' . $product->get_id();
|
76 |
+
|
77 |
+
$ids = array(
|
78 |
+
$product->get_sku(),
|
79 |
+
'wc_post_id_' . $product->get_id(),
|
80 |
+
$retailer_id
|
81 |
+
);
|
82 |
+
|
83 |
+
return $ids;
|
84 |
+
|
85 |
+
}
|
86 |
+
|
87 |
+
add_filter( 'pys_fb_pixel_woo_product_content_type', 'fb_for_woo_pys_fb_pixel_woo_product_content_type', 10, 4 );
|
88 |
+
function fb_for_woo_pys_fb_pixel_woo_product_content_type( $content_type, $product_type, $product, $content_id_format ) {
|
89 |
+
|
90 |
+
if( $content_id_format !== 'facebook_for_woocommerce' ) {
|
91 |
+
return $content_type;
|
92 |
+
}
|
93 |
+
|
94 |
+
if ( $product_type == 'variable' ) {
|
95 |
+
return 'product_group';
|
96 |
+
} else {
|
97 |
+
return 'product';
|
98 |
+
}
|
99 |
+
|
100 |
+
}
|
101 |
+
|
102 |
+
add_filter( 'pys_fb_pixel_woo_cart_item_product_id', 'fb_for_woo_pys_fb_pixel_woo_cart_item_product_id', 10, 3 );
|
103 |
+
function fb_for_woo_pys_fb_pixel_woo_cart_item_product_id( $product_id, $cart_item, $content_id_format ) {
|
104 |
|
105 |
+
if ( $content_id_format !== 'facebook_for_woocommerce' ) {
|
106 |
+
return $product_id;
|
107 |
+
}
|
108 |
|
109 |
+
if ( isset( $cart_item['variation_id'] ) && $cart_item['variation_id'] !== 0 ) {
|
110 |
+
return $cart_item['variation_id'];
|
111 |
+
} else {
|
112 |
+
return $cart_item['product_id'];
|
|
|
113 |
}
|
114 |
|
115 |
+
}
|
116 |
+
|
|
|
|
|
117 |
add_filter( 'pys_fb_pixel_setting_defaults', 'fb_for_woo_pys_fb_pixel_setting_defaults', 10, 1 );
|
118 |
function fb_for_woo_pys_fb_pixel_setting_defaults( $setting_defaults ) {
|
119 |
|
readme.txt
CHANGED
@@ -3,7 +3,7 @@ Contributors: PixelYourSite, c0d3fev3r, themister
|
|
3 |
Tags: Facebook Pixel, New Facebook Pixel, Facebook Conversion Pixel, Facebook Pixel Events, Facebook, New Facebook Pixel Events, Dynamic Events, Standard Events, Facebook Events, Facebook Standard Events, Facebook Dynamic Product Ads, WooCommerce, WooCommerce Facebook Pixel, Facebook Custom Events, Facebook Conversion Value, WooCommerce Affiliate Products, Easy Digital Downloads Pixel, Easy Digital Downloads Facebook Pixel
|
4 |
Requires at least: 3.0.1
|
5 |
Tested up to: 4.8
|
6 |
-
Stable tag: 5.0.
|
7 |
License: GPLv3
|
8 |
License URI: http://www.gnu.org/licenses/gpl-3.0.html
|
9 |
|
@@ -318,6 +318,12 @@ We have an article about how to create Custom Reports:
|
|
318 |
|
319 |
== Changelog ==
|
320 |
|
|
|
|
|
|
|
|
|
|
|
|
|
321 |
= PixelYourSite 5.0.5.2 =
|
322 |
|
323 |
|
3 |
Tags: Facebook Pixel, New Facebook Pixel, Facebook Conversion Pixel, Facebook Pixel Events, Facebook, New Facebook Pixel Events, Dynamic Events, Standard Events, Facebook Events, Facebook Standard Events, Facebook Dynamic Product Ads, WooCommerce, WooCommerce Facebook Pixel, Facebook Custom Events, Facebook Conversion Value, WooCommerce Affiliate Products, Easy Digital Downloads Pixel, Easy Digital Downloads Facebook Pixel
|
4 |
Requires at least: 3.0.1
|
5 |
Tested up to: 4.8
|
6 |
+
Stable tag: 5.0.6
|
7 |
License: GPLv3
|
8 |
License URI: http://www.gnu.org/licenses/gpl-3.0.html
|
9 |
|
318 |
|
319 |
== Changelog ==
|
320 |
|
321 |
+
= PixelYourSite 5.0.6 =
|
322 |
+
|
323 |
+
|
324 |
+
* Facebook for WooCommerce extension integration updated to match the new ID logic (PixelYourSite can be used together with Facebook for WooCommerce extension - this way you can have a Facebook shop without losing our powerful pixel features)
|
325 |
+
|
326 |
+
|
327 |
= PixelYourSite 5.0.5.2 =
|
328 |
|
329 |
|