Version Description
(2021-10-04) = * Fixed: Facebook pixel event issue fixed. * Fixed: Translate press url slug issue fixed. * Fixed: Challan conflict issue fixed.
Download this release
Release Info
Developer | wahid0003 |
Plugin | CTX Feed – WooCommerce Product Feed Manager Plugin |
Version | 4.4.27 |
Comparing to | |
See all releases |
Code changes from version 4.4.26 to 4.4.27
- README.txt +6 -1
- admin/js/woo-feed-facebook-pixel.js +19 -0
- admin/js/woo-feed-facebook-pixel.min.js +2 -0
- admin/js/woo-feed-facebook-pixel.min.js.map +1 -0
- includes/Tracker/Facebook/Pixel.php +238 -0
- includes/helper.php +5 -183
- languages/woo-feed.pot +6 -6
- libs/autoload.php +8 -1
- woo-feed.php +2 -2
README.txt
CHANGED
@@ -5,7 +5,7 @@ Tags: Product Feed, WooCommerce, Google Shopping, Google Merchant, Facebook Cata
|
|
5 |
Requires at least: 4.4
|
6 |
Tested Up To: 5.8
|
7 |
Requires PHP: 5.6
|
8 |
-
Stable tag: 4.4.
|
9 |
License: GPLv2 or later
|
10 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
11 |
|
@@ -516,6 +516,11 @@ Using pro version:
|
|
516 |
|
517 |
== Changelog ==
|
518 |
|
|
|
|
|
|
|
|
|
|
|
519 |
= 4.4.26 (2021-09-24) =
|
520 |
* Fixed: UI issue fixed.
|
521 |
* Fixed: Google category mapping issue fixed.
|
5 |
Requires at least: 4.4
|
6 |
Tested Up To: 5.8
|
7 |
Requires PHP: 5.6
|
8 |
+
Stable tag: 4.4.27
|
9 |
License: GPLv2 or later
|
10 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
11 |
|
516 |
|
517 |
== Changelog ==
|
518 |
|
519 |
+
= 4.4.27 (2021-10-04) =
|
520 |
+
* Fixed: Facebook pixel event issue fixed.
|
521 |
+
* Fixed: Translate press url slug issue fixed.
|
522 |
+
* Fixed: Challan conflict issue fixed.
|
523 |
+
|
524 |
= 4.4.26 (2021-09-24) =
|
525 |
* Fixed: UI issue fixed.
|
526 |
* Fixed: Google category mapping issue fixed.
|
admin/js/woo-feed-facebook-pixel.js
ADDED
@@ -0,0 +1,19 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
(function($, wp) {
|
2 |
+
|
3 |
+
"use strict";
|
4 |
+
$(document).ready(function(){
|
5 |
+
if( typeof fbq === "function" ){
|
6 |
+
$(this.body).on( 'added_to_cart', function( event, fragments, cart_hash, button ){
|
7 |
+
var product_id = button.data('product_id');
|
8 |
+
wp.ajax.post('add_to_cart_facebook_pixel', {product_id: product_id})
|
9 |
+
.done(function(response){
|
10 |
+
fbq( 'track', 'AddToCart', response );
|
11 |
+
})
|
12 |
+
.fail(function (){
|
13 |
+
console.log( "Request Failed!" );
|
14 |
+
});
|
15 |
+
} );
|
16 |
+
}
|
17 |
+
});
|
18 |
+
|
19 |
+
})(jQuery, wp);
|
admin/js/woo-feed-facebook-pixel.min.js
ADDED
@@ -0,0 +1,2 @@
|
|
|
|
|
1 |
+
"use strict";!function(o,c){o(document).ready(function(){"function"==typeof fbq&&o(this.body).on("added_to_cart",function(o,t,d,n){var a=n.data("product_id");c.ajax.post("add_to_cart_facebook_pixel",{product_id:a}).done(function(o){fbq("track","AddToCart",o)}).fail(function(){console.log("Request Failed!")})})})}(jQuery,wp);
|
2 |
+
//# sourceMappingURL=woo-feed-facebook-pixel.min.js.map
|
admin/js/woo-feed-facebook-pixel.min.js.map
ADDED
@@ -0,0 +1 @@
|
|
|
1 |
+
{"version":3,"sources":["woo-feed-facebook-pixel.js"],"names":["$","wp","document","ready","fbq","body","on","event","fragments","cart_hash","product_id","button","data","post","response","fail","console","jQuery"],"mappings":"cAAA,SAACA,EAAAC,GAEGD,EAAAE,UAAAC,MAAA,WAEQ,mBAAAC,KADPJ,EAAAA,KAAWG,MAAZE,GAAkBC,gBAAA,SAAUC,EAAAA,EAAAC,EAAAC,GACbL,IAAAA,EAAPM,EAAJC,KAA+BC,cACpBP,EAAAA,KAAMC,KAAIO,6BAAA,CAAkCL,WAAAA,IAAAA,KAC3CE,SAAaC,GACJP,IAAAA,QAAA,YAAAU,KAAyCC,KAC5CA,WACYC,QAAAA,IAAA,yBATtC,CAGIC,OAAAhB","file":"woo-feed-facebook-pixel.min.js","sourcesContent":["(function($, wp) {\n\n \"use strict\";\n $(document).ready(function(){\n if( typeof fbq === \"function\" ){\n $(this.body).on( 'added_to_cart', function( event, fragments, cart_hash, button ){\n var product_id = button.data('product_id');\n wp.ajax.post('add_to_cart_facebook_pixel', {product_id: product_id})\n .done(function(response){\n fbq( 'track', 'AddToCart', response );\n })\n .fail(function (){\n console.log( \"Request Failed!\" );\n });\n } );\n }\n });\n\n})(jQuery, wp);"]}
|
includes/Tracker/Facebook/Pixel.php
ADDED
@@ -0,0 +1,238 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Managing Facebook pixel events
|
4 |
+
*
|
5 |
+
* @since 4.4.27
|
6 |
+
*/
|
7 |
+
namespace WebAppick\Feed\Tracker\Facebook;
|
8 |
+
|
9 |
+
class Pixel{
|
10 |
+
|
11 |
+
protected $active = false;
|
12 |
+
protected $id = '';
|
13 |
+
|
14 |
+
/**
|
15 |
+
* Initializes facebook pixel
|
16 |
+
*
|
17 |
+
* @return void
|
18 |
+
* @since 4.4.27
|
19 |
+
*/
|
20 |
+
public function __construct(){
|
21 |
+
|
22 |
+
// Loading settings
|
23 |
+
$settings = woo_feed_get_options( 'all' );
|
24 |
+
|
25 |
+
$this->id = $settings['pixel_id'];
|
26 |
+
$this->active = $settings['disable_pixel'] == 'enable' && ! empty( $this->id );
|
27 |
+
|
28 |
+
if( $this->active ){
|
29 |
+
|
30 |
+
add_action( 'wp_enqueue_scripts', [ &$this, 'frontend_script' ] );
|
31 |
+
|
32 |
+
add_action( 'wp_head', [ &$this, 'add_pixel_script' ] );
|
33 |
+
add_action( 'woo_feed_after_pixel_init', [ &$this, 'trigger_event' ], 11 );
|
34 |
+
|
35 |
+
// Ajax add to cart
|
36 |
+
add_action( 'wp_ajax_add_to_cart_facebook_pixel', [ &$this, 'product_add_to_cart_data' ] );
|
37 |
+
add_action( 'wp_ajax_nopriv_add_to_cart_facebook_pixel', [ &$this, 'product_add_to_cart_data' ] );
|
38 |
+
|
39 |
+
}
|
40 |
+
|
41 |
+
}
|
42 |
+
|
43 |
+
/**
|
44 |
+
* Loads Facebook pixel assets
|
45 |
+
*
|
46 |
+
* @return void
|
47 |
+
* @since 4.4.27
|
48 |
+
*/
|
49 |
+
public function frontend_script(){
|
50 |
+
|
51 |
+
wp_enqueue_script( 'woo-feed-facebook-pixel,', WOO_FEED_PLUGIN_URL . 'admin/js/woo-feed-facebook-pixel.js', ['jquery', 'wp-util'], '1.0.0', true );
|
52 |
+
|
53 |
+
}
|
54 |
+
|
55 |
+
/**
|
56 |
+
* Adding initial pixel script on head
|
57 |
+
*
|
58 |
+
* @return void
|
59 |
+
* @since 4.4.27
|
60 |
+
*/
|
61 |
+
public function add_pixel_script() {
|
62 |
+
// @ToDo Language Code check. Currently passing all to `en_US`
|
63 |
+
?>
|
64 |
+
<!-- Facebook Pixel Code -->
|
65 |
+
<script>
|
66 |
+
!function (f, b, e, v, n, t, s) {
|
67 |
+
if (f.fbq) return;
|
68 |
+
n = f.fbq = function () {
|
69 |
+
n.callMethod ?
|
70 |
+
n.callMethod.apply(n, arguments) : n.queue.push(arguments)
|
71 |
+
};
|
72 |
+
if (!f._fbq) f._fbq = n;
|
73 |
+
n.push = n;
|
74 |
+
n.loaded = !0;
|
75 |
+
n.version = '2.0';
|
76 |
+
n.queue = [];
|
77 |
+
t = b.createElement(e);
|
78 |
+
t.async = !0;
|
79 |
+
t.src = v;
|
80 |
+
s = b.getElementsByTagName(e)[0];
|
81 |
+
s.parentNode.insertBefore(t, s)
|
82 |
+
}(window, document, 'script',
|
83 |
+
'https://connect.facebook.net/en_US/fbevents.js');
|
84 |
+
fbq('init', '<?php echo $this->id; ?>');
|
85 |
+
<?php
|
86 |
+
/**
|
87 |
+
* Action after pixel has been initialized in a page on page header. Every event should be fired in this hook
|
88 |
+
*/
|
89 |
+
do_action( 'woo_feed_after_pixel_init' );
|
90 |
+
?>
|
91 |
+
</script>
|
92 |
+
<?php
|
93 |
+
}
|
94 |
+
|
95 |
+
/**
|
96 |
+
* Decides which event to trigger
|
97 |
+
*
|
98 |
+
* @return void
|
99 |
+
* @since 4.4.27
|
100 |
+
*/
|
101 |
+
public function trigger_event(){
|
102 |
+
$event = 'PageView';
|
103 |
+
|
104 |
+
if( is_product() ){
|
105 |
+
$event = 'ViewContent';
|
106 |
+
if( isset( $_POST[ 'add-to-cart' ] ) ){
|
107 |
+
$event = 'AddToCart';
|
108 |
+
}
|
109 |
+
} else if( is_wc_endpoint_url('order-received') ){
|
110 |
+
$event = 'Purchase';
|
111 |
+
} else if( is_checkout() ){
|
112 |
+
$event = 'InitiateCheckout';
|
113 |
+
}
|
114 |
+
|
115 |
+
if( method_exists( Pixel::class, $event ) ){
|
116 |
+
$this->$event();
|
117 |
+
}
|
118 |
+
|
119 |
+
}
|
120 |
+
|
121 |
+
/**
|
122 |
+
* Pageview event
|
123 |
+
*
|
124 |
+
* @return void
|
125 |
+
* @since 4.4.27
|
126 |
+
*/
|
127 |
+
protected function PageView(){
|
128 |
+
?>
|
129 |
+
fbq( 'track', 'PageView' );
|
130 |
+
<?php
|
131 |
+
}
|
132 |
+
|
133 |
+
/**
|
134 |
+
* ViewContent event
|
135 |
+
*
|
136 |
+
* @return void
|
137 |
+
* @since 4.4.27
|
138 |
+
*/
|
139 |
+
protected function ViewContent(){
|
140 |
+
global $post;
|
141 |
+
$_product = wc_get_product( (int) $post->ID );
|
142 |
+
$data = [
|
143 |
+
'content_id' => $_product->get_ID(),
|
144 |
+
'content_name' => $_product->get_title(),
|
145 |
+
'content_type' => 'product',
|
146 |
+
'value' => $_product->get_price(),
|
147 |
+
'currency' => get_option('woocommerce_currency'),
|
148 |
+
|
149 |
+
];
|
150 |
+
?>
|
151 |
+
fbq( 'track', 'ViewContent', <?php echo json_encode( $data ); ?> );
|
152 |
+
<?php
|
153 |
+
}
|
154 |
+
|
155 |
+
/**
|
156 |
+
* Sends json product details on Ajax Add to cart button.
|
157 |
+
*
|
158 |
+
* @return void
|
159 |
+
* @since 4.4.27
|
160 |
+
*/
|
161 |
+
public function product_add_to_cart_data(){
|
162 |
+
|
163 |
+
$product_id = intval( esc_attr( $_POST['product_id'] ) );
|
164 |
+
$_product = wc_get_product( $product_id );
|
165 |
+
|
166 |
+
$data = [
|
167 |
+
'content_id' => $_product->get_ID(),
|
168 |
+
'content_name' => $_product->get_title(),
|
169 |
+
'content_type' => 'product',
|
170 |
+
'value' => $_product->get_price(),
|
171 |
+
'currency' => get_option('woocommerce_currency'),
|
172 |
+
|
173 |
+
];
|
174 |
+
|
175 |
+
wp_send_json_success( json_encode( $data ) );
|
176 |
+
}
|
177 |
+
|
178 |
+
/**
|
179 |
+
* AddToCart event
|
180 |
+
*
|
181 |
+
* @return void
|
182 |
+
* @since 4.4.27
|
183 |
+
*/
|
184 |
+
protected function AddToCart(){
|
185 |
+
|
186 |
+
$product_id = intval( esc_attr( $_POST['add-to-cart'] ) );
|
187 |
+
if( $product_id ){
|
188 |
+
$_product = wc_get_product( $product_id );
|
189 |
+
|
190 |
+
$data = [
|
191 |
+
'content_id' => $_product->get_ID(),
|
192 |
+
'content_name' => $_product->get_title(),
|
193 |
+
'content_type' => 'product',
|
194 |
+
'value' => $_product->get_price(),
|
195 |
+
'currency' => get_option('woocommerce_currency'),
|
196 |
+
|
197 |
+
];
|
198 |
+
}
|
199 |
+
?>
|
200 |
+
fbq( 'track', 'AddToCart', <?php echo json_encode($data); ?> );
|
201 |
+
<?php
|
202 |
+
|
203 |
+
}
|
204 |
+
|
205 |
+
/**
|
206 |
+
* InitiateCheckout event
|
207 |
+
*
|
208 |
+
* @return void
|
209 |
+
* @since 4.4.27
|
210 |
+
*/
|
211 |
+
protected function InitiateCheckout(){
|
212 |
+
?>
|
213 |
+
fbq( 'track', 'InitiateCheckout' );
|
214 |
+
<?php
|
215 |
+
}
|
216 |
+
|
217 |
+
/**
|
218 |
+
* Purchase event
|
219 |
+
*
|
220 |
+
* @return void
|
221 |
+
* @since 4.4.27
|
222 |
+
*/
|
223 |
+
protected function Purchase(){
|
224 |
+
global $wp_query;
|
225 |
+
$order = wc_get_order( $wp_query->query_vars['order-received'] );
|
226 |
+
$data = [
|
227 |
+
'value' => $order->get_total(),
|
228 |
+
'currency' => $order->get_currency()
|
229 |
+
];
|
230 |
+
?>
|
231 |
+
fbq( 'track', 'Purchase', <?php echo json_encode( $data ); ?> );
|
232 |
+
fbq( 'track', 'CompleteRegistration', <?php echo json_encode( $data ); ?> );
|
233 |
+
<?php
|
234 |
+
}
|
235 |
+
|
236 |
+
|
237 |
+
|
238 |
+
}
|
includes/helper.php
CHANGED
@@ -3888,193 +3888,15 @@ if (!function_exists('woo_feed_trim_attribute')) {
|
|
3888 |
}
|
3889 |
}
|
3890 |
|
3891 |
-
|
3892 |
-
|
3893 |
-
* Woo Feed Pixel Support
|
3894 |
-
*/
|
3895 |
-
function woo_feed_pixel_script()
|
3896 |
-
{
|
3897 |
-
|
3898 |
-
global $woocommerce, $post;
|
3899 |
|
3900 |
-
|
3901 |
-
|
3902 |
-
$disable_pixel = $settings['disable_pixel'];
|
3903 |
-
$pixel_id = $settings['pixel_id'];
|
3904 |
-
|
3905 |
-
// Page View Tracking
|
3906 |
-
$view_type = "fbq('track', 'PageView');";
|
3907 |
-
|
3908 |
-
// Product Tracking
|
3909 |
-
if (is_product()) {
|
3910 |
-
$product = wc_get_product($post->ID);
|
3911 |
-
if ($product instanceof WC_Product) {
|
3912 |
-
$product_price = $product->get_price();
|
3913 |
-
$view_type .= "fbq('track', 'ViewContent', {
|
3914 |
-
content_name: '$post->post_title',
|
3915 |
-
content_id: $post->ID,
|
3916 |
-
content_type: 'product',
|
3917 |
-
value: $product_price,
|
3918 |
-
currency: '" . get_option('woocommerce_currency') . "'
|
3919 |
-
});";
|
3920 |
-
}
|
3921 |
-
}
|
3922 |
-
|
3923 |
-
// Purchase Tracking
|
3924 |
-
if (is_wc_endpoint_url('order-received')) {
|
3925 |
-
|
3926 |
-
$product_skus = '';
|
3927 |
-
global $wp_query;
|
3928 |
-
if (!empty($wp_query->query_vars['order-received'])) {
|
3929 |
-
$order = wc_get_order($wp_query->query_vars['order-received']);
|
3930 |
-
if ($order instanceof WC_Order) {
|
3931 |
-
$price = $order->get_total();
|
3932 |
-
$currency = $order->get_currency();
|
3933 |
-
$view_type .= "fbq('track', 'Purchase', {
|
3934 |
-
value: '$price',
|
3935 |
-
currency: '$currency'
|
3936 |
-
});";
|
3937 |
-
$view_type .= "fbq('track', 'CompleteRegistration', {
|
3938 |
-
value: '$price',
|
3939 |
-
currency: '$currency'
|
3940 |
-
})";
|
3941 |
-
}
|
3942 |
-
}
|
3943 |
-
}
|
3944 |
-
|
3945 |
-
if ('enable' == $disable_pixel && !empty($pixel_id)) {
|
3946 |
-
?>
|
3947 |
-
<!-- Facebook Pixel Code -->
|
3948 |
-
<script>
|
3949 |
-
!function (f, b, e, v, n, t, s) {
|
3950 |
-
if (f.fbq) return;
|
3951 |
-
n = f.fbq = function () {
|
3952 |
-
n.callMethod ?
|
3953 |
-
n.callMethod.apply(n, arguments) : n.queue.push(arguments)
|
3954 |
-
};
|
3955 |
-
if (!f._fbq) f._fbq = n;
|
3956 |
-
n.push = n;
|
3957 |
-
n.loaded = !0;
|
3958 |
-
n.version = '2.0';
|
3959 |
-
n.queue = [];
|
3960 |
-
t = b.createElement(e);
|
3961 |
-
t.async = !0;
|
3962 |
-
t.src = v;
|
3963 |
-
s = b.getElementsByTagName(e)[0];
|
3964 |
-
s.parentNode.insertBefore(t, s)
|
3965 |
-
}(window, document, 'script',
|
3966 |
-
'https://connect.facebook.net/en_US/fbevents.js');
|
3967 |
-
fbq('init', '<?php echo $pixel_id; ?>');
|
3968 |
-
<?php echo $view_type; ?>
|
3969 |
-
</script>
|
3970 |
-
<!-- End Facebook Pixel Code -->
|
3971 |
-
<?php
|
3972 |
-
}
|
3973 |
-
}
|
3974 |
-
|
3975 |
-
add_action('wp_head', 'woo_feed_pixel_script');
|
3976 |
-
}
|
3977 |
-
if (!function_exists("woo_feed_add_to_cart_pixel")) {
|
3978 |
-
function woo_feed_add_to_cart_pixel()
|
3979 |
-
{
|
3980 |
-
if (isset($_POST['product_id']) && !empty($_POST['product_id'])) {
|
3981 |
-
$product_id = $_POST['product_id'];
|
3982 |
-
$product = wc_get_product((int)$product_id);
|
3983 |
-
if ($product instanceof WC_Product) {
|
3984 |
-
$product_name = $product->get_title();
|
3985 |
-
$product_id = $product->get_id();
|
3986 |
-
$product_price = $product->get_price();
|
3987 |
-
$currency = get_option('woocommerce_currency');
|
3988 |
-
|
3989 |
-
echo json_encode(
|
3990 |
-
array(
|
3991 |
-
'id' => $product_id,
|
3992 |
-
'name' => $product_name,
|
3993 |
-
'price' => $product_price,
|
3994 |
-
'currency' => $currency,
|
3995 |
-
)
|
3996 |
-
);
|
3997 |
-
wp_die();
|
3998 |
-
}
|
3999 |
-
}
|
4000 |
}
|
4001 |
|
4002 |
-
add_action('
|
4003 |
-
add_action('wp_ajax_nopriv_add_to_cart_pixel', 'woo_feed_add_to_cart_pixel');
|
4004 |
-
}
|
4005 |
-
if (!function_exists('woo_feed_addtocart')) {
|
4006 |
-
/**
|
4007 |
-
* Woo Feed Add to Cart
|
4008 |
-
*/
|
4009 |
-
function woo_feed_addtocart()
|
4010 |
-
{
|
4011 |
-
// Add to Cart Config
|
4012 |
-
$settings = woo_feed_get_options('all');
|
4013 |
-
$disable_pixel = $settings['disable_pixel'];
|
4014 |
-
$pixel_id = $settings['pixel_id'];
|
4015 |
-
$product = '';
|
4016 |
-
$view_type = '';
|
4017 |
-
|
4018 |
-
// Add to Cart Tracking
|
4019 |
-
if ('enable' == $disable_pixel && !empty($pixel_id)) {
|
4020 |
-
|
4021 |
-
if (isset($_POST['add-to-cart'])) {
|
4022 |
-
$product_id = !empty($_POST['add-to-cart']) ? $_POST['add-to-cart'] : "";
|
4023 |
-
$product = wc_get_product((int)$product_id);
|
4024 |
-
}
|
4025 |
-
|
4026 |
-
//when redirect to cart page after add to cart
|
4027 |
-
if ('yes' === get_option('woocommerce_cart_redirect_after_add')) {
|
4028 |
-
if (is_cart()) {
|
4029 |
-
global $woocommerce;
|
4030 |
-
|
4031 |
-
//get cart items
|
4032 |
-
$items = $woocommerce->cart->get_cart();
|
4033 |
-
|
4034 |
-
$ids = array();
|
4035 |
-
if ($items && is_array($items)) {
|
4036 |
-
foreach ($items as $item => $values) {
|
4037 |
-
$_product = wc_get_product($values['data']->get_id());
|
4038 |
-
$ids[] = $_product->get_id();
|
4039 |
-
}
|
4040 |
-
|
4041 |
-
if (!empty($ids)) {
|
4042 |
-
//get last product id in cart
|
4043 |
-
$last_product_id = end($ids);
|
4044 |
-
$product = wc_get_product((int)$last_product_id);
|
4045 |
-
// error_log("last inserted product id is: " . $last_product_id);
|
4046 |
-
}
|
4047 |
-
}
|
4048 |
-
}
|
4049 |
-
}
|
4050 |
-
|
4051 |
-
//create addtocart script
|
4052 |
-
if (!empty($product) && $product instanceof WC_Product) {
|
4053 |
-
$product_name = $product->get_title();
|
4054 |
-
$product_id = $product->get_id();
|
4055 |
-
$product_price = $product->get_price();
|
4056 |
-
$currency = get_option('woocommerce_currency');
|
4057 |
-
|
4058 |
-
$view_type = "<script>
|
4059 |
-
fbq('track', 'AddToCart', {
|
4060 |
-
content_name: '$product_name',
|
4061 |
-
content_ids: $product_id,
|
4062 |
-
content_type: 'product',
|
4063 |
-
value: $product_price,
|
4064 |
-
currency: '$currency',})
|
4065 |
-
</script>";
|
4066 |
-
}
|
4067 |
-
|
4068 |
-
//show addtocart script
|
4069 |
-
if (is_cart() || is_product()) {
|
4070 |
-
if (!empty($view_type)) {
|
4071 |
-
echo $view_type;
|
4072 |
-
}
|
4073 |
-
}
|
4074 |
-
}
|
4075 |
-
}
|
4076 |
|
4077 |
-
add_action('wp_head', 'woo_feed_addtocart');
|
4078 |
}
|
4079 |
|
4080 |
if (!function_exists('woo_feed_filter_dropdown_attributes')) {
|
3888 |
}
|
3889 |
}
|
3890 |
|
3891 |
+
// Facebook pixel integration
|
3892 |
+
if( !function_exists( 'woo_feed_facebook_pixel_init' ) ){
|
|
|
|
|
|
|
|
|
|
|
|
|
3893 |
|
3894 |
+
function woo_feed_facebook_pixel_init(){
|
3895 |
+
new WebAppick\Feed\Tracker\Facebook\Pixel();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
3896 |
}
|
3897 |
|
3898 |
+
add_action( 'init', 'woo_feed_facebook_pixel_init' );
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
3899 |
|
|
|
3900 |
}
|
3901 |
|
3902 |
if (!function_exists('woo_feed_filter_dropdown_attributes')) {
|
languages/woo-feed.pot
CHANGED
@@ -16,7 +16,7 @@ msgstr ""
|
|
16 |
msgid "Unauthorized Action."
|
17 |
msgstr ""
|
18 |
|
19 |
-
#: woo-feed.php:237, woo-feed.php:356, includes/helper.php:852, includes/helper.php:1903, includes/helper.php:2912, includes/helper.php:2941, includes/helper.php:3329, includes/helper.php:3527, includes/helper.php:3555, includes/helper.php:
|
20 |
msgid "Invalid Request."
|
21 |
msgstr ""
|
22 |
|
@@ -709,23 +709,23 @@ msgstr ""
|
|
709 |
msgid "Choose from the most used"
|
710 |
msgstr ""
|
711 |
|
712 |
-
#: includes/helper.php:
|
713 |
msgid "Option Successfully Added."
|
714 |
msgstr ""
|
715 |
|
716 |
-
#: includes/helper.php:
|
717 |
msgid "Option Already Added."
|
718 |
msgstr ""
|
719 |
|
720 |
-
#: includes/helper.php:
|
721 |
msgid "Feed data is empty. Can't duplicate feed."
|
722 |
msgstr ""
|
723 |
|
724 |
-
#: includes/helper.php:
|
725 |
msgid "Unable to save the duplicate feed data."
|
726 |
msgstr ""
|
727 |
|
728 |
-
#: includes/helper.php:
|
729 |
msgid "Feed Successfully Duplicated, but unable to generate the data file. Please click the \"Regenerate Button\""
|
730 |
msgstr ""
|
731 |
|
16 |
msgid "Unauthorized Action."
|
17 |
msgstr ""
|
18 |
|
19 |
+
#: woo-feed.php:237, woo-feed.php:356, includes/helper.php:852, includes/helper.php:1903, includes/helper.php:2912, includes/helper.php:2941, includes/helper.php:3329, includes/helper.php:3527, includes/helper.php:3555, includes/helper.php:4905, includes/helper.php:5403, includes/classes/class-woo-feed-webappick-api.php:428, includes/classes/class-woo-feed-webappick-api.php:452
|
20 |
msgid "Invalid Request."
|
21 |
msgstr ""
|
22 |
|
709 |
msgid "Choose from the most used"
|
710 |
msgstr ""
|
711 |
|
712 |
+
#: includes/helper.php:4614
|
713 |
msgid "Option Successfully Added."
|
714 |
msgstr ""
|
715 |
|
716 |
+
#: includes/helper.php:4605
|
717 |
msgid "Option Already Added."
|
718 |
msgstr ""
|
719 |
|
720 |
+
#: includes/helper.php:5411
|
721 |
msgid "Feed data is empty. Can't duplicate feed."
|
722 |
msgstr ""
|
723 |
|
724 |
+
#: includes/helper.php:5427
|
725 |
msgid "Unable to save the duplicate feed data."
|
726 |
msgstr ""
|
727 |
|
728 |
+
#: includes/helper.php:5437
|
729 |
msgid "Feed Successfully Duplicated, but unable to generate the data file. Please click the \"Regenerate Button\""
|
730 |
msgstr ""
|
731 |
|
libs/autoload.php
CHANGED
@@ -17,8 +17,15 @@ function woo_feed_autoloader($class){
|
|
17 |
$file_path = dirname( __FILE__ ) . DIRECTORY_SEPARATOR
|
18 |
. str_replace( '\\', DIRECTORY_SEPARATOR, $class ) . '.php';
|
19 |
|
20 |
-
|
|
|
|
|
|
|
|
|
21 |
require_once $file_path;
|
|
|
|
|
|
|
22 |
|
23 |
}
|
24 |
|
17 |
$file_path = dirname( __FILE__ ) . DIRECTORY_SEPARATOR
|
18 |
. str_replace( '\\', DIRECTORY_SEPARATOR, $class ) . '.php';
|
19 |
|
20 |
+
$file_secondary_path = dirname( __FILE__ ) . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR . 'includes'
|
21 |
+
. str_replace( '\\', DIRECTORY_SEPARATOR, $class ) . '.php';
|
22 |
+
$file_secondary_path = str_replace( 'WebAppick/Feed', '', $file_secondary_path );
|
23 |
+
|
24 |
+
if( file_exists( $file_path ) ) {
|
25 |
require_once $file_path;
|
26 |
+
} else if( file_exists( $file_secondary_path ) ){
|
27 |
+
require_once( $file_secondary_path );
|
28 |
+
}
|
29 |
|
30 |
}
|
31 |
|
woo-feed.php
CHANGED
@@ -10,7 +10,7 @@
|
|
10 |
* Plugin Name: CTX Feed
|
11 |
* Plugin URI: https://webappick.com/
|
12 |
* Description: Easily generate woocommerce product feed for any marketing channel like Google Shopping(Merchant), Facebook Remarketing, Bing, eBay & more. Support 100+ Merchants.
|
13 |
-
* Version: 4.4.
|
14 |
* Author: WebAppick
|
15 |
* Author URI: https://webappick.com/
|
16 |
* License: GPL v2
|
@@ -42,7 +42,7 @@ if ( ! defined( 'WOO_FEED_FREE_VERSION' ) ) {
|
|
42 |
* @var string
|
43 |
* @since 3.1.6
|
44 |
*/
|
45 |
-
define( 'WOO_FEED_FREE_VERSION', '4.4.
|
46 |
}
|
47 |
|
48 |
if ( ! defined( 'WOO_FEED_FREE_FILE' ) ) {
|
10 |
* Plugin Name: CTX Feed
|
11 |
* Plugin URI: https://webappick.com/
|
12 |
* Description: Easily generate woocommerce product feed for any marketing channel like Google Shopping(Merchant), Facebook Remarketing, Bing, eBay & more. Support 100+ Merchants.
|
13 |
+
* Version: 4.4.27
|
14 |
* Author: WebAppick
|
15 |
* Author URI: https://webappick.com/
|
16 |
* License: GPL v2
|
42 |
* @var string
|
43 |
* @since 3.1.6
|
44 |
*/
|
45 |
+
define( 'WOO_FEED_FREE_VERSION', '4.4.27' );
|
46 |
}
|
47 |
|
48 |
if ( ! defined( 'WOO_FEED_FREE_FILE' ) ) {
|