Facebook for WooCommerce - Version 2.6.8

Version Description

  • 2021-12-21 =
  • Fix - Bump template from 1.0.4 to 1.0.5. #2115
  • Fix - Fix empty "value" for variable products. #1784
  • Tweak - WC 6.0 compatibility.
  • Tweak - WP 5.9 compatibility.
Download this release

Release Info

Developer automattic
Plugin Icon Facebook for WooCommerce
Version 2.6.8
Comparing to
See all releases

Code changes from version 2.6.7 to 2.6.8

changelog.txt CHANGED
@@ -1,6 +1,12 @@
1
  *** Facebook for WooCommerce Changelog ***
2
 
3
- 2021-11-04 - version 2.6.7
 
 
 
 
 
 
4
  * Fix - Parameter overloading error for PHP70 #2112
5
 
6
  2021-11-03 - version 2.6.6
1
  *** Facebook for WooCommerce Changelog ***
2
 
3
+ = 2.6.8 - 2021-12-21 =
4
+ * Fix - Bump template from 1.0.4 to 1.0.5. #2115
5
+ * Fix - Fix empty "value" for variable products. #1784
6
+ * Tweak - WC 6.0 compatibility.
7
+ * Tweak - WP 5.9 compatibility.
8
+
9
+ 2021-11-04 - version 2.6.7
10
  * Fix - Parameter overloading error for PHP70 #2112
11
 
12
  2021-11-03 - version 2.6.6
facebook-commerce-events-tracker.php CHANGED
@@ -511,6 +511,12 @@ if ( ! class_exists( 'WC_Facebookcommerce_EventsTracker' ) ) :
511
  } else {
512
  $content_type = 'product';
513
  }
 
 
 
 
 
 
514
 
515
  $categories = \WC_Facebookcommerce_Utils::get_product_categories( $product->get_id() );
516
 
@@ -529,7 +535,7 @@ if ( ! class_exists( 'WC_Facebookcommerce_EventsTracker' ) ) :
529
  )
530
  ),
531
  'content_category' => $categories['name'],
532
- 'value' => $product->get_price(),
533
  'currency' => get_woocommerce_currency(),
534
  ),
535
  'user_data' => $this->pixel->get_user_info(),
511
  } else {
512
  $content_type = 'product';
513
  }
514
+
515
+ if ( WC_Facebookcommerce_Utils::is_variable_type( $product->get_type() ) ) {
516
+ $product_price = $product->get_variation_price( 'min' );
517
+ } else {
518
+ $product_price = $product->get_price();
519
+ }
520
 
521
  $categories = \WC_Facebookcommerce_Utils::get_product_categories( $product->get_id() );
522
 
535
  )
536
  ),
537
  'content_category' => $categories['name'],
538
+ 'value' => $product_price,
539
  'currency' => get_woocommerce_currency(),
540
  ),
541
  'user_data' => $this->pixel->get_user_info(),
facebook-commerce.php CHANGED
@@ -113,9 +113,6 @@ class WC_Facebookcommerce_Integration extends WC_Integration {
113
  /** @var string the short product description mode name */
114
  const PRODUCT_DESCRIPTION_MODE_SHORT = 'short';
115
 
116
- /** @var string the hook for the recurreing action that syncs products */
117
- const ACTION_HOOK_SCHEDULED_RESYNC = 'sync_all_fb_products_using_feed';
118
-
119
  /** @var string custom taxonomy FB product set ID */
120
  const FB_PRODUCT_SET_ID = 'fb_product_set_id';
121
 
@@ -326,12 +323,6 @@ class WC_Facebookcommerce_Integration extends WC_Integration {
326
  self::FB_PRIORITY_MID
327
  );
328
 
329
- add_action(
330
- 'wp_ajax_ajax_sync_all_fb_products_using_feed',
331
- array( $this, 'ajax_sync_all_fb_products_using_feed' ),
332
- self::FB_PRIORITY_MID
333
- );
334
-
335
  add_action(
336
  'wp_ajax_ajax_check_feed_upload_status',
337
  array( $this, 'ajax_check_feed_upload_status' ),
@@ -348,12 +339,6 @@ class WC_Facebookcommerce_Integration extends WC_Integration {
348
  array( $this, 'ajax_display_test_result' )
349
  );
350
 
351
- add_action(
352
- 'wp_ajax_ajax_schedule_force_resync',
353
- array( $this, 'ajax_schedule_force_resync' ),
354
- self::FB_PRIORITY_MID
355
- );
356
-
357
  // Don't duplicate product FBID meta.
358
  add_filter( 'woocommerce_duplicate_product_exclude_meta', array( $this, 'fb_duplicate_product_reset_meta' ) );
359
 
@@ -419,8 +404,6 @@ class WC_Facebookcommerce_Integration extends WC_Integration {
419
  $this->load_background_sync_process();
420
  }
421
 
422
- // Must be outside of admin for cron to schedule correctly.
423
- add_action( 'sync_all_fb_products_using_feed', array( $this, 'handle_scheduled_resync_action' ), self::FB_PRIORITY_MID );
424
 
425
  if ( $this->get_facebook_pixel_id() ) {
426
  $aam_settings = $this->load_aam_settings_of_pixel();
@@ -1804,7 +1787,7 @@ class WC_Facebookcommerce_Integration extends WC_Integration {
1804
  */
1805
  function display_error_message_from_result( $result ) {
1806
  $error = json_decode( $result['body'] )->error;
1807
- $msg = ( 'Fatal' === $error->message && ! empty( $error->error_user_title ) ) ? $error->error_user_title : $error_message;
1808
  $this->display_error_message( $msg );
1809
  }
1810
 
@@ -2127,7 +2110,7 @@ class WC_Facebookcommerce_Integration extends WC_Integration {
2127
  WC_Facebookcommerce_Utils::check_woo_ajax_permissions( 'syncall products', true );
2128
  check_ajax_referer( 'wc_facebook_settings_jsx' );
2129
 
2130
- $this->sync_facebook_products( 'background' );
2131
  }
2132
 
2133
 
@@ -2139,22 +2122,11 @@ class WC_Facebookcommerce_Integration extends WC_Integration {
2139
  *
2140
  * @since 1.10.2
2141
  *
2142
- * @param string $method either 'feed' or 'background'
2143
  */
2144
- private function sync_facebook_products( $method ) {
2145
 
2146
  try {
2147
-
2148
- if ( 'feed' === $method ) {
2149
-
2150
- $this->sync_facebook_products_using_feed();
2151
-
2152
- } elseif ( 'background' === $method ) {
2153
-
2154
- // if syncs starts, the background processor will continue executing until the request ends and no response will be sent back to the browser
2155
- $this->sync_facebook_products_using_background_processor();
2156
- }
2157
-
2158
  wp_send_json_success();
2159
 
2160
  } catch ( Framework\SV_WC_Plugin_Exception $e ) {
@@ -2332,121 +2304,6 @@ class WC_Facebookcommerce_Integration extends WC_Integration {
2332
  return true;
2333
  }
2334
 
2335
-
2336
- /**
2337
- * Special function to run all visible products by uploading feed.
2338
- *
2339
- * @internal
2340
- */
2341
- public function ajax_sync_all_fb_products_using_feed() {
2342
- WC_Facebookcommerce_Utils::check_woo_ajax_permissions(
2343
- 'syncall products using feed',
2344
- ! $this->test_mode
2345
- );
2346
- check_ajax_referer( 'wc_facebook_settings_jsx' );
2347
-
2348
- $this->sync_facebook_products( 'feed' );
2349
- }
2350
-
2351
-
2352
- /**
2353
- * Syncs Facebook products using a Feed.
2354
- *
2355
- * @see https://developers.facebook.com/docs/marketing-api/fbe/fbe1/guides/feed-approach
2356
- *
2357
- * @since 1.10.2
2358
- *
2359
- * @throws Framework\SV_WC_Plugin_Exception
2360
- * @return bool
2361
- */
2362
- public function sync_facebook_products_using_feed() {
2363
-
2364
- if ( ! $this->is_product_sync_enabled() ) {
2365
- WC_Facebookcommerce_Utils::log( 'Sync to Facebook is disabled' );
2366
-
2367
- throw new Framework\SV_WC_Plugin_Exception( __( 'Product sync is disabled.', 'facebook-for-woocommerce' ) );
2368
- }
2369
-
2370
- if ( ! $this->is_configured() || ! $this->get_product_catalog_id() ) {
2371
-
2372
- WC_Facebookcommerce_Utils::log( sprintf( 'Not syncing, the plugin is not configured or the Catalog ID is missing' ) );
2373
-
2374
- throw new Framework\SV_WC_Plugin_Exception( __( 'The plugin is not configured or the Catalog ID is missing.', 'facebook-for-woocommerce' ) );
2375
- }
2376
-
2377
- $this->remove_resync_message();
2378
-
2379
- if ( ! $this->fbgraph->is_product_catalog_valid( $this->get_product_catalog_id() ) ) {
2380
-
2381
- WC_Facebookcommerce_Utils::log( 'Not syncing, invalid product catalog!' );
2382
- WC_Facebookcommerce_Utils::fblog(
2383
- 'Tried to sync with an invalid product catalog!',
2384
- array(),
2385
- true
2386
- );
2387
-
2388
- throw new Framework\SV_WC_Plugin_Exception( __( "We've detected that your Facebook Product Catalog is no longer valid. This may happen if it was deleted, but could also be a temporary error. If the error persists, please click Manage connection > Advanced Options > Remove and setup the plugin again.", 'facebook-for-woocommerce' ) );
2389
- }
2390
-
2391
- if ( ! class_exists( 'WC_Facebook_Product_Feed' ) ) {
2392
- include_once 'includes/fbproductfeed.php';
2393
- }
2394
- if ( $this->test_mode ) {
2395
- $this->fbproductfeed = new WC_Facebook_Product_Feed_Test_Mock(
2396
- $this->get_product_catalog_id(),
2397
- $this->fbgraph,
2398
- $this->get_feed_id()
2399
- );
2400
- } else {
2401
- $this->fbproductfeed = new WC_Facebook_Product_Feed(
2402
- $this->get_product_catalog_id(),
2403
- $this->fbgraph,
2404
- $this->get_feed_id()
2405
- );
2406
- }
2407
-
2408
- if ( ! $this->fbproductfeed->sync_all_products_using_feed() ) {
2409
-
2410
- WC_Facebookcommerce_Utils::fblog( 'Sync all products using feed, curl failed', array(), true );
2411
-
2412
- throw new Framework\SV_WC_Plugin_Exception( __( "We couldn't create the feed or upload the product information.", 'facebook-for-woocommerce' ) );
2413
- }
2414
-
2415
- $this->update_feed_id( $this->fbproductfeed->feed_id );
2416
- $this->update_upload_id( $this->fbproductfeed->upload_id );
2417
-
2418
- update_option(
2419
- $this->get_option_key(),
2420
- apply_filters( 'woocommerce_settings_api_sanitized_fields_' . $this->id, $this->settings )
2421
- );
2422
-
2423
- wp_reset_postdata();
2424
-
2425
- return true;
2426
- }
2427
-
2428
-
2429
- /**
2430
- * Syncs Facebook products using a Feed.
2431
- *
2432
- * TODO: deprecate this methid in 1.11.0 or newer {WV 2020-03-12}
2433
- *
2434
- * @see https://developers.facebook.com/docs/marketing-api/fbe/fbe1/guides/feed-approach
2435
- *
2436
- * @return bool
2437
- */
2438
- public function sync_all_fb_products_using_feed() {
2439
-
2440
- try {
2441
- $sync_started = $this->sync_facebook_products_using_feed();
2442
- } catch ( Framework\SV_WC_Plugin_Exception $e ) {
2443
- $sync_started = false;
2444
- }
2445
-
2446
- return $sync_started;
2447
- }
2448
-
2449
-
2450
  /**
2451
  * Toggles product visibility via AJAX.
2452
  *
@@ -3719,106 +3576,6 @@ class WC_Facebookcommerce_Integration extends WC_Integration {
3719
  wp_die();
3720
  }
3721
 
3722
-
3723
- /**
3724
- * Schedules a recurring event to sync products.
3725
- *
3726
- * @deprecated 1.10.0
3727
- */
3728
- function ajax_schedule_force_resync() {
3729
-
3730
- wc_deprecated_function( __METHOD__, '1.10.0' );
3731
- die;
3732
- }
3733
-
3734
-
3735
- /**
3736
- * Adds an recurring action to sync products.
3737
- *
3738
- * The action is scheduled using a cron schedule instead of a recurring interval (see https://en.wikipedia.org/wiki/Cron#Overview).
3739
- * A cron schedule should allow for the action to run roughly at the same time every day regardless of the duration of the task.
3740
- *
3741
- * @since 1.10.0
3742
- *
3743
- * @param int $offset number of seconds since the beginning of the daay
3744
- */
3745
- public function schedule_resync( $offset ) {
3746
-
3747
- try {
3748
-
3749
- $current_time = new DateTime( 'now', new DateTimeZone( wc_timezone_string() ) );
3750
- $first_scheduled_time = new DateTime( "today +{$offset} seconds", new DateTimeZone( wc_timezone_string() ) );
3751
- $next_scheduled_time = new DateTime( "today +1 day {$offset} seconds", new DateTimeZone( wc_timezone_string() ) );
3752
-
3753
- } catch ( \Exception $e ) {
3754
- // TODO: log an error indicating that it was not possible to schedule a recurring action to sync products {WV 2020-01-28}
3755
- return;
3756
- }
3757
-
3758
- // unschedule previously scheduled resync actions
3759
- $this->unschedule_resync();
3760
-
3761
- $timestamp = $first_scheduled_time >= $current_time ? $first_scheduled_time->getTimestamp() : $next_scheduled_time->getTimestamp();
3762
-
3763
- // TODO: replace 'facebook-for-woocommerce' with the plugin ID once we stat using the Framework {WV 2020-01-30}
3764
- as_schedule_single_action( $timestamp, self::ACTION_HOOK_SCHEDULED_RESYNC, array(), 'facebook-for-woocommerce' );
3765
- }
3766
-
3767
-
3768
- /**
3769
- * Removes the recurring action that syncs products.
3770
- *
3771
- * @since 1.10.0
3772
- */
3773
- private function unschedule_resync() {
3774
-
3775
- // TODO: replace 'facebook-for-woocommerce' with the plugin ID once we stat using the Framework {WV 2020-01-30}
3776
- as_unschedule_all_actions( self::ACTION_HOOK_SCHEDULED_RESYNC, array(), 'facebook-for-woocommerce' );
3777
- }
3778
-
3779
-
3780
- /**
3781
- * Determines whether a recurring action to sync products is scheduled and not running.
3782
- *
3783
- * @see \as_next_scheduled_action()
3784
- *
3785
- * @since 1.10.0
3786
- *
3787
- * @return bool
3788
- */
3789
- public function is_resync_scheduled() {
3790
-
3791
- // TODO: replace 'facebook-for-woocommerce' with the plugin ID once we stat using the Framework {WV 2020-01-30}
3792
- return is_int( as_next_scheduled_action( self::ACTION_HOOK_SCHEDULED_RESYNC, array(), 'facebook-for-woocommerce' ) );
3793
- }
3794
-
3795
-
3796
- /**
3797
- * Handles the scheduled action used to sync products daily.
3798
- *
3799
- * It will schedule a new action if product sync is enabled and the plugin is configured to resnyc procucts daily.
3800
- *
3801
- * @internal
3802
- *
3803
- * @see \WC_Facebookcommerce_Integration::schedule_resync()
3804
- *
3805
- * @since 1.10.0
3806
- */
3807
- public function handle_scheduled_resync_action() {
3808
-
3809
- try {
3810
- $this->sync_facebook_products_using_feed();
3811
- } catch ( Framework\SV_WC_Plugin_Exception $e ) {
3812
- }
3813
-
3814
- $resync_offset = $this->get_scheduled_resync_offset();
3815
-
3816
- // manually schedule the next product resync action if possible
3817
- if ( null !== $resync_offset && $this->is_product_sync_enabled() && ! $this->is_resync_scheduled() ) {
3818
- $this->schedule_resync( $resync_offset );
3819
- }
3820
- }
3821
-
3822
  /** Deprecated methods ********************************************************************************************/
3823
 
3824
 
113
  /** @var string the short product description mode name */
114
  const PRODUCT_DESCRIPTION_MODE_SHORT = 'short';
115
 
 
 
 
116
  /** @var string custom taxonomy FB product set ID */
117
  const FB_PRODUCT_SET_ID = 'fb_product_set_id';
118
 
323
  self::FB_PRIORITY_MID
324
  );
325
 
 
 
 
 
 
 
326
  add_action(
327
  'wp_ajax_ajax_check_feed_upload_status',
328
  array( $this, 'ajax_check_feed_upload_status' ),
339
  array( $this, 'ajax_display_test_result' )
340
  );
341
 
 
 
 
 
 
 
342
  // Don't duplicate product FBID meta.
343
  add_filter( 'woocommerce_duplicate_product_exclude_meta', array( $this, 'fb_duplicate_product_reset_meta' ) );
344
 
404
  $this->load_background_sync_process();
405
  }
406
 
 
 
407
 
408
  if ( $this->get_facebook_pixel_id() ) {
409
  $aam_settings = $this->load_aam_settings_of_pixel();
1787
  */
1788
  function display_error_message_from_result( $result ) {
1789
  $error = json_decode( $result['body'] )->error;
1790
+ $msg = ( 'Fatal' === $error->message && ! empty( $error->error_user_title ) ) ? $error->error_user_title : $error->message;
1791
  $this->display_error_message( $msg );
1792
  }
1793
 
2110
  WC_Facebookcommerce_Utils::check_woo_ajax_permissions( 'syncall products', true );
2111
  check_ajax_referer( 'wc_facebook_settings_jsx' );
2112
 
2113
+ $this->sync_facebook_products();
2114
  }
2115
 
2116
 
2122
  *
2123
  * @since 1.10.2
2124
  *
 
2125
  */
2126
+ private function sync_facebook_products() {
2127
 
2128
  try {
2129
+ $this->sync_facebook_products_using_background_processor();
 
 
 
 
 
 
 
 
 
 
2130
  wp_send_json_success();
2131
 
2132
  } catch ( Framework\SV_WC_Plugin_Exception $e ) {
2304
  return true;
2305
  }
2306
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2307
  /**
2308
  * Toggles product visibility via AJAX.
2309
  *
3576
  wp_die();
3577
  }
3578
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
3579
  /** Deprecated methods ********************************************************************************************/
3580
 
3581
 
facebook-for-woocommerce.php CHANGED
@@ -11,11 +11,11 @@
11
  * Description: Grow your business on Facebook! Use this official plugin to help sell more of your products using Facebook. After completing the setup, you'll be ready to create ads that promote your products and you can also create a shop section on your Page where customers can browse your products on Facebook.
12
  * Author: Facebook
13
  * Author URI: https://www.facebook.com/
14
- * Version: 2.6.7
15
  * Text Domain: facebook-for-woocommerce
16
- * Tested up to: 5.8
17
  * WC requires at least: 3.5.0
18
- * WC tested up to: 5.7
19
  * Requires PHP: 7.0
20
  *
21
  * @package FacebookCommerce
@@ -33,7 +33,7 @@ class WC_Facebook_Loader {
33
  /**
34
  * @var string the plugin version. This must be in the main plugin file to be automatically bumped by Woorelease.
35
  */
36
- const PLUGIN_VERSION = '2.6.7'; // WRCS: DEFINED_VERSION.
37
 
38
  // Minimum PHP version required by this plugin.
39
  const MINIMUM_PHP_VERSION = '7.0.0';
11
  * Description: Grow your business on Facebook! Use this official plugin to help sell more of your products using Facebook. After completing the setup, you'll be ready to create ads that promote your products and you can also create a shop section on your Page where customers can browse your products on Facebook.
12
  * Author: Facebook
13
  * Author URI: https://www.facebook.com/
14
+ * Version: 2.6.8
15
  * Text Domain: facebook-for-woocommerce
16
+ * Tested up to: 5.9
17
  * WC requires at least: 3.5.0
18
+ * WC tested up to: 6.0
19
  * Requires PHP: 7.0
20
  *
21
  * @package FacebookCommerce
33
  /**
34
  * @var string the plugin version. This must be in the main plugin file to be automatically bumped by Woorelease.
35
  */
36
+ const PLUGIN_VERSION = '2.6.8'; // WRCS: DEFINED_VERSION.
37
 
38
  // Minimum PHP version required by this plugin.
39
  const MINIMUM_PHP_VERSION = '7.0.0';
i18n/languages/facebook-for-woocommerce.pot CHANGED
@@ -2,10 +2,10 @@
2
  # This file is distributed under the same license as the Facebook for WooCommerce package.
3
  msgid ""
4
  msgstr ""
5
- "Project-Id-Version: Facebook for WooCommerce 2.6.7\n"
6
  "Report-Msgid-Bugs-To: "
7
  "https://woocommerce.com/my-account/marketplace-ticket-form/\n"
8
- "POT-Creation-Date: 2021-11-04 07:48:36+00:00\n"
9
  "MIME-Version: 1.0\n"
10
  "Content-Type: text/plain; charset=utf-8\n"
11
  "Content-Transfer-Encoding: 8bit\n"
@@ -107,49 +107,49 @@ msgstr ""
107
  msgid "Facebook for WooCommerce"
108
  msgstr ""
109
 
110
- #: facebook-commerce.php:236
111
  msgid "Facebook Commerce and Dynamic Ads (Pixel) Extension"
112
  msgstr ""
113
 
114
- #: facebook-commerce.php:1415
115
  msgid "Nothing to update for product group for %1$s"
116
  msgstr ""
117
 
118
- #: facebook-commerce.php:1828
119
  #. translators: Placeholders %1$s - original error message from Facebook API
120
  msgid "There was an issue connecting to the Facebook API: %1$s"
121
  msgstr ""
122
 
123
- #: facebook-commerce.php:2164
124
  msgid "Your connection has expired."
125
  msgstr ""
126
 
127
- #: facebook-commerce.php:2164
128
  msgid ""
129
  "Please click Manage connection > Advanced Options > Update Token to refresh "
130
  "your connection to Facebook."
131
  msgstr ""
132
 
133
- #: facebook-commerce.php:2171
134
  #. translators: Placeholders %s - error message
135
  msgid "There was an error trying to sync the products to Facebook. %s"
136
  msgstr ""
137
 
138
- #: facebook-commerce.php:2194 facebook-commerce.php:2367
139
  msgid "Product sync is disabled."
140
  msgstr ""
141
 
142
- #: facebook-commerce.php:2201 facebook-commerce.php:2374
143
  msgid "The plugin is not configured or the Catalog ID is missing."
144
  msgstr ""
145
 
146
- #: facebook-commerce.php:2224
147
  msgid ""
148
  "A product sync is in progress. Please wait until the sync finishes before "
149
  "starting a new one."
150
  msgstr ""
151
 
152
- #: facebook-commerce.php:2236 facebook-commerce.php:2388
153
  msgid ""
154
  "We've detected that your Facebook Product Catalog is no longer valid. This "
155
  "may happen if it was deleted, but could also be a temporary error. If the "
@@ -157,33 +157,29 @@ msgid ""
157
  "and setup the plugin again."
158
  msgstr ""
159
 
160
- #: facebook-commerce.php:2412
161
- msgid "We couldn't create the feed or upload the product information."
162
- msgstr ""
163
-
164
- #: facebook-commerce.php:2880
165
  msgid "Hi! We're here to answer any questions you may have."
166
  msgstr ""
167
 
168
- #: facebook-commerce.php:3270
169
  msgid "Facebook for WooCommerce error:"
170
  msgstr ""
171
 
172
- #: facebook-commerce.php:3352
173
  msgid ""
174
  "There was an error trying to retrieve information about the Facebook page: "
175
  "%s"
176
  msgstr ""
177
 
178
- #: facebook-commerce.php:3403
179
  msgid "Get started with Messenger Customer Chat"
180
  msgstr ""
181
 
182
- #: facebook-commerce.php:3404
183
  msgid "Get started with Instagram Shopping"
184
  msgstr ""
185
 
186
- #: facebook-commerce.php:3639
187
  #. translators: Placeholders %1$s - original error message from Facebook API
188
  msgid "There was an issue connecting to the Facebook API: %s"
189
  msgstr ""
@@ -982,85 +978,85 @@ msgstr ""
982
  msgid "Other"
983
  msgstr ""
984
 
985
- #: includes/Handlers/Connection.php:324
986
  msgid "Connection successful!"
987
  msgstr ""
988
 
989
- #: includes/Handlers/Connection.php:355
990
  msgid "You do not have permission to uninstall Facebook Business Extension."
991
  msgstr ""
992
 
993
- #: includes/Handlers/Connection.php:365
994
  msgid "Disconnection successful."
995
  msgstr ""
996
 
997
- #: includes/Handlers/Connection.php:430
998
  #. translators: Placeholders: %s - API error message
999
  msgid "Could not retrieve page access data. %s"
1000
  msgstr ""
1001
 
1002
- #: includes/Handlers/Connection.php:444
1003
  #. translators: Placeholders: %s - Facebook page ID
1004
  msgid "Page %s not authorized."
1005
  msgstr ""
1006
 
1007
- #: includes/Handlers/Connection.php:1387
1008
  msgid "You do not have permission to finish App Store login."
1009
  msgstr ""
1010
 
1011
- #: includes/ProductSync/ProductValidator.php:185
1012
  msgid "Product sync is globally disabled."
1013
  msgstr ""
1014
 
1015
- #: includes/ProductSync/ProductValidator.php:198
1016
  msgid "Product is not published."
1017
  msgstr ""
1018
 
1019
- #: includes/ProductSync/ProductValidator.php:209
1020
  msgid "Product must be in stock."
1021
  msgstr ""
1022
 
1023
- #: includes/ProductSync/ProductValidator.php:224
1024
  msgid "Product is hidden from catalog and search."
1025
  msgstr ""
1026
 
1027
- #: includes/ProductSync/ProductValidator.php:239
1028
  msgid "Product excluded because of categories."
1029
  msgstr ""
1030
 
1031
- #: includes/ProductSync/ProductValidator.php:246
1032
  msgid "Product excluded because of tags."
1033
  msgstr ""
1034
 
1035
- #: includes/ProductSync/ProductValidator.php:257
1036
  msgid "Sync disabled in product field."
1037
  msgstr ""
1038
 
1039
- #: includes/ProductSync/ProductValidator.php:292
1040
  msgid "If product is not simple, variable or variation it must have a price."
1041
  msgstr ""
1042
 
1043
- #: includes/ProductSync/ProductValidator.php:318
1044
  msgid ""
1045
  "Product description is all capital letters. Please change the description "
1046
  "to sentence case in order to allow synchronization of your product."
1047
  msgstr ""
1048
 
1049
- #: includes/ProductSync/ProductValidator.php:321
1050
  msgid "Product description is too long. Maximum allowed length is 5000 characters."
1051
  msgstr ""
1052
 
1053
- #: includes/ProductSync/ProductValidator.php:340
1054
  msgid ""
1055
  "Product title is all capital letters. Please change the title to sentence "
1056
  "case in order to allow synchronization of your product."
1057
  msgstr ""
1058
 
1059
- #: includes/ProductSync/ProductValidator.php:343
1060
  msgid "Product title is too long. Maximum allowed length is 150 characters."
1061
  msgstr ""
1062
 
1063
- #: includes/ProductSync/ProductValidator.php:367
1064
  msgid "Too many attributes selected for product. Use 4 or less."
1065
  msgstr ""
1066
 
2
  # This file is distributed under the same license as the Facebook for WooCommerce package.
3
  msgid ""
4
  msgstr ""
5
+ "Project-Id-Version: Facebook for WooCommerce 2.6.8\n"
6
  "Report-Msgid-Bugs-To: "
7
  "https://woocommerce.com/my-account/marketplace-ticket-form/\n"
8
+ "POT-Creation-Date: 2021-12-21 10:57:51+00:00\n"
9
  "MIME-Version: 1.0\n"
10
  "Content-Type: text/plain; charset=utf-8\n"
11
  "Content-Transfer-Encoding: 8bit\n"
107
  msgid "Facebook for WooCommerce"
108
  msgstr ""
109
 
110
+ #: facebook-commerce.php:233
111
  msgid "Facebook Commerce and Dynamic Ads (Pixel) Extension"
112
  msgstr ""
113
 
114
+ #: facebook-commerce.php:1398
115
  msgid "Nothing to update for product group for %1$s"
116
  msgstr ""
117
 
118
+ #: facebook-commerce.php:1811
119
  #. translators: Placeholders %1$s - original error message from Facebook API
120
  msgid "There was an issue connecting to the Facebook API: %1$s"
121
  msgstr ""
122
 
123
+ #: facebook-commerce.php:2136
124
  msgid "Your connection has expired."
125
  msgstr ""
126
 
127
+ #: facebook-commerce.php:2136
128
  msgid ""
129
  "Please click Manage connection > Advanced Options > Update Token to refresh "
130
  "your connection to Facebook."
131
  msgstr ""
132
 
133
+ #: facebook-commerce.php:2143
134
  #. translators: Placeholders %s - error message
135
  msgid "There was an error trying to sync the products to Facebook. %s"
136
  msgstr ""
137
 
138
+ #: facebook-commerce.php:2166
139
  msgid "Product sync is disabled."
140
  msgstr ""
141
 
142
+ #: facebook-commerce.php:2173
143
  msgid "The plugin is not configured or the Catalog ID is missing."
144
  msgstr ""
145
 
146
+ #: facebook-commerce.php:2196
147
  msgid ""
148
  "A product sync is in progress. Please wait until the sync finishes before "
149
  "starting a new one."
150
  msgstr ""
151
 
152
+ #: facebook-commerce.php:2208
153
  msgid ""
154
  "We've detected that your Facebook Product Catalog is no longer valid. This "
155
  "may happen if it was deleted, but could also be a temporary error. If the "
157
  "and setup the plugin again."
158
  msgstr ""
159
 
160
+ #: facebook-commerce.php:2737
 
 
 
 
161
  msgid "Hi! We're here to answer any questions you may have."
162
  msgstr ""
163
 
164
+ #: facebook-commerce.php:3127
165
  msgid "Facebook for WooCommerce error:"
166
  msgstr ""
167
 
168
+ #: facebook-commerce.php:3209
169
  msgid ""
170
  "There was an error trying to retrieve information about the Facebook page: "
171
  "%s"
172
  msgstr ""
173
 
174
+ #: facebook-commerce.php:3260
175
  msgid "Get started with Messenger Customer Chat"
176
  msgstr ""
177
 
178
+ #: facebook-commerce.php:3261
179
  msgid "Get started with Instagram Shopping"
180
  msgstr ""
181
 
182
+ #: facebook-commerce.php:3496
183
  #. translators: Placeholders %1$s - original error message from Facebook API
184
  msgid "There was an issue connecting to the Facebook API: %s"
185
  msgstr ""
978
  msgid "Other"
979
  msgstr ""
980
 
981
+ #: includes/Handlers/Connection.php:327
982
  msgid "Connection successful!"
983
  msgstr ""
984
 
985
+ #: includes/Handlers/Connection.php:381
986
  msgid "You do not have permission to uninstall Facebook Business Extension."
987
  msgstr ""
988
 
989
+ #: includes/Handlers/Connection.php:391
990
  msgid "Disconnection successful."
991
  msgstr ""
992
 
993
+ #: includes/Handlers/Connection.php:456
994
  #. translators: Placeholders: %s - API error message
995
  msgid "Could not retrieve page access data. %s"
996
  msgstr ""
997
 
998
+ #: includes/Handlers/Connection.php:470
999
  #. translators: Placeholders: %s - Facebook page ID
1000
  msgid "Page %s not authorized."
1001
  msgstr ""
1002
 
1003
+ #: includes/Handlers/Connection.php:1430
1004
  msgid "You do not have permission to finish App Store login."
1005
  msgstr ""
1006
 
1007
+ #: includes/ProductSync/ProductValidator.php:195
1008
  msgid "Product sync is globally disabled."
1009
  msgstr ""
1010
 
1011
+ #: includes/ProductSync/ProductValidator.php:208
1012
  msgid "Product is not published."
1013
  msgstr ""
1014
 
1015
+ #: includes/ProductSync/ProductValidator.php:219
1016
  msgid "Product must be in stock."
1017
  msgstr ""
1018
 
1019
+ #: includes/ProductSync/ProductValidator.php:234
1020
  msgid "Product is hidden from catalog and search."
1021
  msgstr ""
1022
 
1023
+ #: includes/ProductSync/ProductValidator.php:249
1024
  msgid "Product excluded because of categories."
1025
  msgstr ""
1026
 
1027
+ #: includes/ProductSync/ProductValidator.php:256
1028
  msgid "Product excluded because of tags."
1029
  msgstr ""
1030
 
1031
+ #: includes/ProductSync/ProductValidator.php:267
1032
  msgid "Sync disabled in product field."
1033
  msgstr ""
1034
 
1035
+ #: includes/ProductSync/ProductValidator.php:302
1036
  msgid "If product is not simple, variable or variation it must have a price."
1037
  msgstr ""
1038
 
1039
+ #: includes/ProductSync/ProductValidator.php:328
1040
  msgid ""
1041
  "Product description is all capital letters. Please change the description "
1042
  "to sentence case in order to allow synchronization of your product."
1043
  msgstr ""
1044
 
1045
+ #: includes/ProductSync/ProductValidator.php:331
1046
  msgid "Product description is too long. Maximum allowed length is 5000 characters."
1047
  msgstr ""
1048
 
1049
+ #: includes/ProductSync/ProductValidator.php:350
1050
  msgid ""
1051
  "Product title is all capital letters. Please change the title to sentence "
1052
  "case in order to allow synchronization of your product."
1053
  msgstr ""
1054
 
1055
+ #: includes/ProductSync/ProductValidator.php:353
1056
  msgid "Product title is too long. Maximum allowed length is 150 characters."
1057
  msgstr ""
1058
 
1059
+ #: includes/ProductSync/ProductValidator.php:377
1060
  msgid "Too many attributes selected for product. Use 4 or less."
1061
  msgstr ""
1062
 
includes/Feed/FeedConfigurationDetection.php CHANGED
@@ -78,7 +78,7 @@ class FeedConfigurationDetection {
78
  * If one has the same ID as $integration_feed_id, we use that.
79
  * Otherwise we pick the one that was most recently updated.
80
  */
81
- $active_feed_metadata = null;
82
  foreach ( $feed_nodes as $feed ) {
83
  $metadata = $this->get_feed_metadata( $feed['id'], $graph_api );
84
 
@@ -97,8 +97,20 @@ class FeedConfigurationDetection {
97
  }
98
  }
99
 
100
- $active_feed['created-time'] = gmdate( 'Y-m-d H:i:s', strtotime( $active_feed_metadata['created_time'] ) );
101
- $active_feed['product-count'] = $active_feed_metadata['product_count'];
 
 
 
 
 
 
 
 
 
 
 
 
102
 
103
  /*
104
  * Upload schedule settings can be in two keys:
@@ -118,9 +130,9 @@ class FeedConfigurationDetection {
118
 
119
  $info['active-feed'] = $active_feed;
120
 
121
- $latest_upload = $active_feed_metadata['latest_upload'];
122
  if ( array_key_exists( 'latest_upload', $active_feed_metadata ) ) {
123
- $upload = array();
 
124
 
125
  if ( array_key_exists( 'end_time', $latest_upload ) ) {
126
  $upload['end-time'] = gmdate( 'Y-m-d H:i:s', strtotime( $latest_upload['end_time'] ) );
78
  * If one has the same ID as $integration_feed_id, we use that.
79
  * Otherwise we pick the one that was most recently updated.
80
  */
81
+ $active_feed_metadata = array();
82
  foreach ( $feed_nodes as $feed ) {
83
  $metadata = $this->get_feed_metadata( $feed['id'], $graph_api );
84
 
97
  }
98
  }
99
 
100
+ if ( empty( $active_feed_metadata ) ) {
101
+ // No active feed available, we don't have data to collect.
102
+ $info['active-feed'] = null;
103
+ return $info;
104
+ }
105
+
106
+ $active_feed = array();
107
+ if ( array_key_exists( 'created_time', $active_feed_metadata ) ) {
108
+ $active_feed['created-time'] = gmdate( 'Y-m-d H:i:s', strtotime( $active_feed_metadata['created_time'] ) );
109
+ }
110
+
111
+ if ( array_key_exists( 'product_count', $active_feed_metadata ) ) {
112
+ $active_feed['product-count'] = $active_feed_metadata['product_count'];
113
+ }
114
 
115
  /*
116
  * Upload schedule settings can be in two keys:
130
 
131
  $info['active-feed'] = $active_feed;
132
 
 
133
  if ( array_key_exists( 'latest_upload', $active_feed_metadata ) ) {
134
+ $latest_upload = $active_feed_metadata['latest_upload'];
135
+ $upload = array();
136
 
137
  if ( array_key_exists( 'end_time', $latest_upload ) ) {
138
  $upload['end-time'] = gmdate( 'Y-m-d H:i:s', strtotime( $latest_upload['end_time'] ) );
includes/Handlers/Connection.php CHANGED
@@ -37,6 +37,9 @@ class Connection {
37
  /** @var string WooCommerce connection for APP Store login URL */
38
  const APP_STORE_LOGIN_URL = 'https://connect.woocommerce.com/app-store-login/facebook/';
39
 
 
 
 
40
  /** @var string the Standard Auth type */
41
  const AUTH_TYPE_STANDARD = 'standard';
42
 
@@ -168,7 +171,7 @@ class Connection {
168
  }
169
  }
170
  } catch ( SV_WC_API_Exception $exception ) {
171
-
172
  $this->get_plugin()->log( 'Could not refresh business configuration. ' . $exception->getMessage() );
173
  }
174
 
@@ -276,7 +279,7 @@ class Connection {
276
  }
277
 
278
  $is_error = ! empty( $_GET['err'] ) ? true : false;
279
- $error_code = ! empty( $_GET['err_code'] ) ? sanitize_text_field( $_GET['err_code'] ) : '';
280
  $merchant_access_token = ! empty( $_GET['merchant_access_token'] ) ? sanitize_text_field( $_GET['merchant_access_token'] ) : '';
281
  $system_user_access_token = ! empty( $_GET['system_user_access_token'] ) ? sanitize_text_field( $_GET['system_user_access_token'] ) : '';
282
  $system_user_id = ! empty( $_GET['system_user_id'] ) ? sanitize_text_field( $_GET['system_user_id'] ) : '';
@@ -329,8 +332,9 @@ class Connection {
329
 
330
  set_transient( 'wc_facebook_connection_failed', time(), 30 );
331
  } catch ( Connect_WC_API_Exception $exception ) {
 
332
 
333
- facebook_for_woocommerce()->log( sprintf( 'Failed to connect to Facebook. Facebook API returned error code: %s', $exception->getMessage() ), 'facebook_for_woocommerce_connect' );
334
 
335
  set_transient( 'wc_facebook_connection_failed', time(), 30 );
336
  }
@@ -339,6 +343,28 @@ class Connection {
339
  exit;
340
  }
341
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
342
 
343
  /**
344
  * Disconnects the integration using the Graph API.
@@ -566,7 +592,7 @@ class Connection {
566
  );
567
 
568
  // build the proxy app URL where the user will land after onboarding, to be redirected to the site URL
569
- $redirect_url = add_query_arg( 'site_url', urlencode( $site_url ), 'https://connect.woocommerce.com/auth/facebookcommerce/' );
570
 
571
  // build the final connect URL, direct to Facebook
572
  $connect_url = add_query_arg(
@@ -848,6 +874,23 @@ class Connection {
848
  return (string) apply_filters( 'wc_facebook_connection_app_store_login_url', self::APP_STORE_LOGIN_URL );
849
  }
850
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
851
 
852
  /**
853
  * Gets the full redirect URL where the user will return to after OAuth.
@@ -1195,15 +1238,15 @@ class Connection {
1195
 
1196
  $this->get_plugin()->log( 'Wrong (or empty) WebHook Event received' );
1197
  $this->get_plugin()->log( print_r( $data, true ) ); //phpcs:ignore WordPress.PHP.DevelopmentFunctions.error_log_print_r
1198
-
1199
  return;
1200
  }
1201
 
1202
  $log_data = array();
1203
-
1204
  $this->get_plugin()->log( 'WebHook User Event received' );
1205
  $this->get_plugin()->log( print_r( $data, true ) ); //phpcs:ignore WordPress.PHP.DevelopmentFunctions.error_log_print_r
1206
-
1207
 
1208
  $entry = (array) $data->entry[0];
1209
  if ( empty( $entry ) ) {
37
  /** @var string WooCommerce connection for APP Store login URL */
38
  const APP_STORE_LOGIN_URL = 'https://connect.woocommerce.com/app-store-login/facebook/';
39
 
40
+ /** @var string WooCommerce connection authentication URL */
41
+ const CONNECTION_AUTHENTICATION_URL = 'https://connect.woocommerce.com/auth/facebookcommerce/';
42
+
43
  /** @var string the Standard Auth type */
44
  const AUTH_TYPE_STANDARD = 'standard';
45
 
171
  }
172
  }
173
  } catch ( SV_WC_API_Exception $exception ) {
174
+
175
  $this->get_plugin()->log( 'Could not refresh business configuration. ' . $exception->getMessage() );
176
  }
177
 
279
  }
280
 
281
  $is_error = ! empty( $_GET['err'] ) ? true : false;
282
+ $error_code = ! empty( $_GET['err_code'] ) ? stripslashes( sanitize_text_field( $_GET['err_code'] ) ) : '';
283
  $merchant_access_token = ! empty( $_GET['merchant_access_token'] ) ? sanitize_text_field( $_GET['merchant_access_token'] ) : '';
284
  $system_user_access_token = ! empty( $_GET['system_user_access_token'] ) ? sanitize_text_field( $_GET['system_user_access_token'] ) : '';
285
  $system_user_id = ! empty( $_GET['system_user_id'] ) ? sanitize_text_field( $_GET['system_user_id'] ) : '';
332
 
333
  set_transient( 'wc_facebook_connection_failed', time(), 30 );
334
  } catch ( Connect_WC_API_Exception $exception ) {
335
+ $message = $this->prepare_connect_server_message_for_user_display( $exception->getMessage() );
336
 
337
+ facebook_for_woocommerce()->log( sprintf( 'Failed to connect to Facebook. Reason: %s', $message ), 'facebook_for_woocommerce_connect' );
338
 
339
  set_transient( 'wc_facebook_connection_failed', time(), 30 );
340
  }
343
  exit;
344
  }
345
 
346
+ /**
347
+ * Prepares the error message from the connect server for the logs.
348
+ *
349
+ * @since 2.6.8
350
+ * @param string $message Message string that needs formatting.
351
+ * @return string Formatted message string ready for logging.
352
+ */
353
+ public function prepare_connect_server_message_for_user_display( $message ) {
354
+ /*
355
+ * In some scenarios the connect server message is a JSON encoded object.
356
+ * This happens when we have detailed information from Facebook API endpoint about the error.
357
+ * We want to print it pretty for the customers.
358
+ */
359
+ $decoded_message = json_decode( $message );
360
+ if ( json_last_error() === JSON_ERROR_NONE ) {
361
+ // If error is the first key we want to use just the body to simplify the message.
362
+ $decoded_message = isset( $decoded_message->error ) ? $decoded_message->error : $decoded_message;
363
+ $message = json_encode( $decoded_message, JSON_PRETTY_PRINT );
364
+ }
365
+ return $message;
366
+ }
367
+
368
 
369
  /**
370
  * Disconnects the integration using the Graph API.
592
  );
593
 
594
  // build the proxy app URL where the user will land after onboarding, to be redirected to the site URL
595
+ $redirect_url = add_query_arg( 'site_url', urlencode( $site_url ), $this->get_connection_authentication_url() );
596
 
597
  // build the final connect URL, direct to Facebook
598
  $connect_url = add_query_arg(
874
  return (string) apply_filters( 'wc_facebook_connection_app_store_login_url', self::APP_STORE_LOGIN_URL );
875
  }
876
 
877
+ /**
878
+ * Gets connect server authentication url.
879
+ *
880
+ * @since 2.6.8
881
+ *
882
+ * @return string URL
883
+ */
884
+ public function get_connection_authentication_url() {
885
+ /**
886
+ * Filters App Store login URL.
887
+ *
888
+ * @since 2.6.8
889
+ *
890
+ * @param string $connection_authentication_url the connection App Store login URL
891
+ */
892
+ return (string) apply_filters( 'wc_facebook_connection_authentication_url', self::CONNECTION_AUTHENTICATION_URL );
893
+ }
894
 
895
  /**
896
  * Gets the full redirect URL where the user will return to after OAuth.
1238
 
1239
  $this->get_plugin()->log( 'Wrong (or empty) WebHook Event received' );
1240
  $this->get_plugin()->log( print_r( $data, true ) ); //phpcs:ignore WordPress.PHP.DevelopmentFunctions.error_log_print_r
1241
+
1242
  return;
1243
  }
1244
 
1245
  $log_data = array();
1246
+
1247
  $this->get_plugin()->log( 'WebHook User Event received' );
1248
  $this->get_plugin()->log( print_r( $data, true ) ); //phpcs:ignore WordPress.PHP.DevelopmentFunctions.error_log_print_r
1249
+
1250
 
1251
  $entry = (array) $data->entry[0];
1252
  if ( empty( $entry ) ) {
includes/Lifecycle.php CHANGED
@@ -184,15 +184,6 @@ class Lifecycle extends Framework\Plugin\Lifecycle {
184
 
185
  update_option( 'woocommerce_' . \WC_Facebookcommerce::INTEGRATION_ID . '_settings', $new_settings );
186
 
187
- // schedule the next product resync action
188
- if ( $new_settings[ \WC_Facebookcommerce_Integration::SETTING_SCHEDULED_RESYNC_OFFSET ] && 'yes' === $new_settings[ \WC_Facebookcommerce_Integration::SETTING_ENABLE_PRODUCT_SYNC ] ) {
189
-
190
- $integration = $this->get_plugin()->get_integration();
191
-
192
- if ( ! $integration->is_resync_scheduled() ) {
193
- $integration->schedule_resync( $new_settings[ \WC_Facebookcommerce_Integration::SETTING_SCHEDULED_RESYNC_OFFSET ] );
194
- }
195
- }
196
  }
197
 
198
 
184
 
185
  update_option( 'woocommerce_' . \WC_Facebookcommerce::INTEGRATION_ID . '_settings', $new_settings );
186
 
 
 
 
 
 
 
 
 
 
187
  }
188
 
189
 
includes/ProductSync/ProductValidator.php CHANGED
@@ -69,6 +69,13 @@ class ProductValidator {
69
  */
70
  protected $product_parent;
71
 
 
 
 
 
 
 
 
72
  /**
73
  * ProductValidator constructor.
74
  *
@@ -76,17 +83,20 @@ class ProductValidator {
76
  * @param WC_Product $product The product to validate. Accepts both variations and variable products.
77
  */
78
  public function __construct( WC_Facebookcommerce_Integration $integration, WC_Product $product ) {
79
- $this->product = $product;
80
- $this->facebook_product = new WC_Facebook_Product( $product->get_id() );
 
81
 
82
  if ( $product->get_parent_id() ) {
83
  $parent_product = wc_get_product( $product->get_parent_id() );
84
  if ( $parent_product instanceof WC_Product ) {
85
- $this->product_parent = $parent_product;
 
86
  }
87
  }
88
 
89
- $this->integration = $integration;
 
90
  }
91
 
92
  /**
69
  */
70
  protected $product_parent;
71
 
72
+ /**
73
+ * The product parent object if the product has a parent.
74
+ *
75
+ * @var WC_Facebook_Product
76
+ */
77
+ protected $fb_product_parent;
78
+
79
  /**
80
  * ProductValidator constructor.
81
  *
83
  * @param WC_Product $product The product to validate. Accepts both variations and variable products.
84
  */
85
  public function __construct( WC_Facebookcommerce_Integration $integration, WC_Product $product ) {
86
+ $this->product = $product;
87
+ $this->product_parent = null;
88
+ $this->fb_product_parent = null;
89
 
90
  if ( $product->get_parent_id() ) {
91
  $parent_product = wc_get_product( $product->get_parent_id() );
92
  if ( $parent_product instanceof WC_Product ) {
93
+ $this->product_parent = $parent_product;
94
+ $this->fb_product_parent = new WC_Facebook_Product( $parent_product );
95
  }
96
  }
97
 
98
+ $this->facebook_product = new WC_Facebook_Product( $this->product, $this->fb_product_parent );
99
+ $this->integration = $integration;
100
  }
101
 
102
  /**
includes/test/facebook-integration-test.php CHANGED
@@ -69,101 +69,6 @@ if ( ! class_exists( 'WC_Facebook_Integration_Test' ) ) :
69
 
70
  self::$commerce = $commerce;
71
 
72
- add_action(
73
- 'wp_ajax_ajax_test_sync_products_using_feed',
74
- array( $this, 'ajax_test_sync_products_using_feed' )
75
- );
76
- }
77
-
78
- /**
79
- * Test visible products by uploading feed.
80
- **/
81
- function ajax_test_sync_products_using_feed() {
82
- self::$test_mode = true;
83
- // test ajax reset all products in db
84
- $reset = self::$commerce->reset_all_products();
85
- if ( $reset ) {
86
- WC_Facebookcommerce_Utils::log( 'Test - Removing FBIDs from all products' );
87
- $this->product_post_wpid = $this->create_data();
88
- if ( empty( $this->product_post_wpid ) ) {
89
- self::$test_pass = 0;
90
- WC_Facebookcommerce_Utils::log(
91
- 'Test - Fail to create test product by inserting posts.'
92
- );
93
- WC_Facebookcommerce_Utils::set_test_fail_reason(
94
- 'Fail to create test products by inserting posts.',
95
- ( new Exception() )->getTraceAsString()
96
- );
97
- update_option( 'fb_test_pass', false );
98
- wp_die();
99
- return;
100
- }
101
- $this->set_product_wpid( $this->product_post_wpid );
102
- $upload_success =
103
- self::$commerce->ajax_sync_all_fb_products_using_feed( true );
104
- if ( $upload_success ) {
105
- // verification Step.
106
- // Wait till FB finish backend creation to prevent race condition.
107
- $time_start = microtime( true );
108
- while ( ( microtime( true ) - $time_start ) < self::MAX_SLEEP_IN_SEC ) {
109
- $complete = self::$commerce->fbproductfeed->is_upload_complete(
110
- self::$commerce->settings
111
- );
112
- if ( $complete ) {
113
- break;
114
- } else {
115
- $this->sleep_til_upload_complete( 10 );
116
- }
117
- }
118
- $this->sleep_til_upload_complete( 60 );
119
- $check_product_create = $this->check_product_create();
120
- if ( ! $check_product_create ) {
121
- self::$test_pass = 0;
122
- } else {
123
- WC_Facebookcommerce_Utils::log(
124
- 'Test - Products create successfully.'
125
- );
126
- }
127
- // Clean up whatever has been created.
128
- // Test on_product_delete API hook.
129
- $clean_up = $this->clean_up();
130
- if ( ! $clean_up ) {
131
- self::$test_pass = 0;
132
- WC_Facebookcommerce_Utils::log(
133
- 'Test - Fail to delete product from FB'
134
- );
135
- WC_Facebookcommerce_Utils::set_test_fail_reason(
136
- 'Fail to delete product from FB',
137
- ( new Exception() )->getTraceAsString()
138
- );
139
- } else {
140
- WC_Facebookcommerce_Utils::log(
141
- 'Test - Delete product from FB successfully'
142
- );
143
- }
144
- } else {
145
- self::$test_pass = 0;
146
- WC_Facebookcommerce_Utils::log(
147
- 'Test - Sync all products using feed, curl failed.'
148
- );
149
- WC_Facebookcommerce_Utils::set_test_fail_reason(
150
- 'Sync all products using feed, curl failed',
151
- ( new Exception() )->getTraceAsString()
152
- );
153
- }
154
- } else {
155
- self::$test_pass = 0;
156
- WC_Facebookcommerce_Utils::log(
157
- 'Test - Fail to remove FBIDs from local DB'
158
- );
159
- WC_Facebookcommerce_Utils::set_test_fail_reason(
160
- 'Fail to remove FBIDs from local DB',
161
- ( new Exception() )->getTraceAsString()
162
- );
163
- }
164
- update_option( 'fb_test_pass', self::$test_pass );
165
- wp_die();
166
- return;
167
  }
168
 
169
  function check_product_create() {
69
 
70
  self::$commerce = $commerce;
71
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
72
  }
73
 
74
  function check_product_create() {
readme.txt CHANGED
@@ -2,8 +2,8 @@
2
  Contributors: facebook, automattic, woothemes
3
  Tags: facebook, shop, catalog, advertise, pixel, product
4
  Requires at least: 4.4
5
- Tested up to: 5.8
6
- Stable tag: 2.6.7
7
  Requires PHP: 5.6 or greater
8
  MySQL: 5.6 or greater
9
  License: GPLv2 or later
@@ -37,9 +37,15 @@ When opening a bug on GitHub, please give us as many details as possible.
37
  * Your website URL
38
  * Current version of Facebook-for-WooCommerce, WooCommerce, Wordpress, PHP
39
 
40
- == Changelog =
41
 
42
- = 2.6.7 - 2021-11-04 =
 
 
 
 
 
 
43
  * Fix - Parameter overloading error for PHP70 #2112
44
 
45
  = 2.6.6 - 2021-11-03 =
2
  Contributors: facebook, automattic, woothemes
3
  Tags: facebook, shop, catalog, advertise, pixel, product
4
  Requires at least: 4.4
5
+ Tested up to: 5.9
6
+ Stable tag: 2.6.8
7
  Requires PHP: 5.6 or greater
8
  MySQL: 5.6 or greater
9
  License: GPLv2 or later
37
  * Your website URL
38
  * Current version of Facebook-for-WooCommerce, WooCommerce, Wordpress, PHP
39
 
40
+ == Changelog ==
41
 
42
+ = 2.6.8 - 2021-12-21 =
43
+ * Fix - Bump template from 1.0.4 to 1.0.5. #2115
44
+ * Fix - Fix empty "value" for variable products. #1784
45
+ * Tweak - WC 6.0 compatibility.
46
+ * Tweak - WP 5.9 compatibility.
47
+
48
+ = 2.6.7 - 2021-11-04 =
49
  * Fix - Parameter overloading error for PHP70 #2112
50
 
51
  = 2.6.6 - 2021-11-03 =
vendor/autoload.php CHANGED
@@ -4,4 +4,4 @@
4
 
5
  require_once __DIR__ . '/composer/autoload_real.php';
6
 
7
- return ComposerAutoloaderInit92fe4636df1c1640ca27b8521c8de3a7::getLoader();
4
 
5
  require_once __DIR__ . '/composer/autoload_real.php';
6
 
7
+ return ComposerAutoloaderInit49cdde79378180527690a72431d1b0f7::getLoader();
vendor/composer/InstalledVersions.php CHANGED
@@ -24,8 +24,21 @@ use Composer\Semver\VersionParser;
24
  */
25
  class InstalledVersions
26
  {
 
 
 
 
27
  private static $installed;
 
 
 
 
28
  private static $canGetVendors;
 
 
 
 
 
29
  private static $installedByVendor = array();
30
 
31
  /**
24
  */
25
  class InstalledVersions
26
  {
27
+ /**
28
+ * @var mixed[]|null
29
+ * @psalm-var array{root: array{name: string, version: string, reference: string, pretty_version: string, aliases: string[], dev: bool, install_path: string, type: string}, versions: array<string, array{dev_requirement: bool, pretty_version?: string, version?: string, aliases?: string[], reference?: string, replaced?: string[], provided?: string[], install_path?: string, type?: string}>}|array{}|null
30
+ */
31
  private static $installed;
32
+
33
+ /**
34
+ * @var bool|null
35
+ */
36
  private static $canGetVendors;
37
+
38
+ /**
39
+ * @var array[]
40
+ * @psalm-var array<string, array{root: array{name: string, version: string, reference: string, pretty_version: string, aliases: string[], dev: bool, install_path: string, type: string}, versions: array<string, array{dev_requirement: bool, pretty_version?: string, version?: string, aliases?: string[], reference?: string, replaced?: string[], provided?: string[], install_path?: string, type?: string}>}>
41
+ */
42
  private static $installedByVendor = array();
43
 
44
  /**
vendor/composer/autoload_real.php CHANGED
@@ -2,7 +2,7 @@
2
 
3
  // autoload_real.php @generated by Composer
4
 
5
- class ComposerAutoloaderInit92fe4636df1c1640ca27b8521c8de3a7
6
  {
7
  private static $loader;
8
 
@@ -24,15 +24,15 @@ class ComposerAutoloaderInit92fe4636df1c1640ca27b8521c8de3a7
24
 
25
  require __DIR__ . '/platform_check.php';
26
 
27
- spl_autoload_register(array('ComposerAutoloaderInit92fe4636df1c1640ca27b8521c8de3a7', 'loadClassLoader'), true, true);
28
  self::$loader = $loader = new \Composer\Autoload\ClassLoader(\dirname(\dirname(__FILE__)));
29
- spl_autoload_unregister(array('ComposerAutoloaderInit92fe4636df1c1640ca27b8521c8de3a7', 'loadClassLoader'));
30
 
31
  $useStaticLoader = PHP_VERSION_ID >= 50600 && !defined('HHVM_VERSION') && (!function_exists('zend_loader_file_encoded') || !zend_loader_file_encoded());
32
  if ($useStaticLoader) {
33
  require __DIR__ . '/autoload_static.php';
34
 
35
- call_user_func(\Composer\Autoload\ComposerStaticInit92fe4636df1c1640ca27b8521c8de3a7::getInitializer($loader));
36
  } else {
37
  $map = require __DIR__ . '/autoload_namespaces.php';
38
  foreach ($map as $namespace => $path) {
2
 
3
  // autoload_real.php @generated by Composer
4
 
5
+ class ComposerAutoloaderInit49cdde79378180527690a72431d1b0f7
6
  {
7
  private static $loader;
8
 
24
 
25
  require __DIR__ . '/platform_check.php';
26
 
27
+ spl_autoload_register(array('ComposerAutoloaderInit49cdde79378180527690a72431d1b0f7', 'loadClassLoader'), true, true);
28
  self::$loader = $loader = new \Composer\Autoload\ClassLoader(\dirname(\dirname(__FILE__)));
29
+ spl_autoload_unregister(array('ComposerAutoloaderInit49cdde79378180527690a72431d1b0f7', 'loadClassLoader'));
30
 
31
  $useStaticLoader = PHP_VERSION_ID >= 50600 && !defined('HHVM_VERSION') && (!function_exists('zend_loader_file_encoded') || !zend_loader_file_encoded());
32
  if ($useStaticLoader) {
33
  require __DIR__ . '/autoload_static.php';
34
 
35
+ call_user_func(\Composer\Autoload\ComposerStaticInit49cdde79378180527690a72431d1b0f7::getInitializer($loader));
36
  } else {
37
  $map = require __DIR__ . '/autoload_namespaces.php';
38
  foreach ($map as $namespace => $path) {
vendor/composer/autoload_static.php CHANGED
@@ -4,7 +4,7 @@
4
 
5
  namespace Composer\Autoload;
6
 
7
- class ComposerStaticInit92fe4636df1c1640ca27b8521c8de3a7
8
  {
9
  public static $prefixLengthsPsr4 = array (
10
  'S' =>
@@ -43,9 +43,9 @@ class ComposerStaticInit92fe4636df1c1640ca27b8521c8de3a7
43
  public static function getInitializer(ClassLoader $loader)
44
  {
45
  return \Closure::bind(function () use ($loader) {
46
- $loader->prefixLengthsPsr4 = ComposerStaticInit92fe4636df1c1640ca27b8521c8de3a7::$prefixLengthsPsr4;
47
- $loader->prefixDirsPsr4 = ComposerStaticInit92fe4636df1c1640ca27b8521c8de3a7::$prefixDirsPsr4;
48
- $loader->classMap = ComposerStaticInit92fe4636df1c1640ca27b8521c8de3a7::$classMap;
49
 
50
  }, null, ClassLoader::class);
51
  }
4
 
5
  namespace Composer\Autoload;
6
 
7
+ class ComposerStaticInit49cdde79378180527690a72431d1b0f7
8
  {
9
  public static $prefixLengthsPsr4 = array (
10
  'S' =>
43
  public static function getInitializer(ClassLoader $loader)
44
  {
45
  return \Closure::bind(function () use ($loader) {
46
+ $loader->prefixLengthsPsr4 = ComposerStaticInit49cdde79378180527690a72431d1b0f7::$prefixLengthsPsr4;
47
+ $loader->prefixDirsPsr4 = ComposerStaticInit49cdde79378180527690a72431d1b0f7::$prefixDirsPsr4;
48
+ $loader->classMap = ComposerStaticInit49cdde79378180527690a72431d1b0f7::$classMap;
49
 
50
  }, null, ClassLoader::class);
51
  }
vendor/composer/installed.php CHANGED
@@ -1,11 +1,11 @@
1
  <?php return array(
2
  'root' => array(
3
- 'pretty_version' => 'dev-release/2.6.7',
4
- 'version' => 'dev-release/2.6.7',
5
  'type' => 'wordpress-plugin',
6
  'install_path' => __DIR__ . '/../../',
7
  'aliases' => array(),
8
- 'reference' => 'c3ebc12044d01b5ab4887bdb58f787fb0db83ed9',
9
  'name' => 'facebookincubator/facebook-for-woocommerce',
10
  'dev' => false,
11
  ),
@@ -20,12 +20,12 @@
20
  'dev_requirement' => false,
21
  ),
22
  'facebookincubator/facebook-for-woocommerce' => array(
23
- 'pretty_version' => 'dev-release/2.6.7',
24
- 'version' => 'dev-release/2.6.7',
25
  'type' => 'wordpress-plugin',
26
  'install_path' => __DIR__ . '/../../',
27
  'aliases' => array(),
28
- 'reference' => 'c3ebc12044d01b5ab4887bdb58f787fb0db83ed9',
29
  'dev_requirement' => false,
30
  ),
31
  'roundcube/plugin-installer' => array(
1
  <?php return array(
2
  'root' => array(
3
+ 'pretty_version' => 'dev-release/2.6.8',
4
+ 'version' => 'dev-release/2.6.8',
5
  'type' => 'wordpress-plugin',
6
  'install_path' => __DIR__ . '/../../',
7
  'aliases' => array(),
8
+ 'reference' => '17bb878950c8ed54d2d2239b8a5d2dd99688eec4',
9
  'name' => 'facebookincubator/facebook-for-woocommerce',
10
  'dev' => false,
11
  ),
20
  'dev_requirement' => false,
21
  ),
22
  'facebookincubator/facebook-for-woocommerce' => array(
23
+ 'pretty_version' => 'dev-release/2.6.8',
24
+ 'version' => 'dev-release/2.6.8',
25
  'type' => 'wordpress-plugin',
26
  'install_path' => __DIR__ . '/../../',
27
  'aliases' => array(),
28
+ 'reference' => '17bb878950c8ed54d2d2239b8a5d2dd99688eec4',
29
  'dev_requirement' => false,
30
  ),
31
  'roundcube/plugin-installer' => array(