Facebook for WooCommerce - Version 2.6.13

Version Description

  • 2022-04-26 =
  • Fix - Issue with Facebook not displayed in the new WC navigation.
  • Fix - Issue with variable products syncing to FB product sets.
  • Fix - Scheduled job logs written to options table are never removed if job does not complete.
  • Fix - User-Agent to contain English extension name.
  • Fix - clear out wc_facebook_external_business_id option on disconnect.
  • Fix - fix product title length check to account for encoding.
  • Tweak - Use Automattic\WooCommerce\Admin\Features\Features::is_enabled instead of the deprecated WooCommerce\Admin\Loader::is_feature_enabled.
Download this release

Release Info

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

Code changes from version 2.6.12 to 2.6.13

changelog.txt CHANGED
@@ -1,5 +1,14 @@
1
  *** Facebook for WooCommerce Changelog ***
2
 
 
 
 
 
 
 
 
 
 
3
  2022-03-08 - version 2.6.12
4
  * Add - Filter to change Facebook Retailer ID, wc_facebook_fb_retailer_id.
5
 
1
  *** Facebook for WooCommerce Changelog ***
2
 
3
+ = 2.6.13 - 2022-04-26 =
4
+ * Fix - Issue with Facebook not displayed in the new WC navigation.
5
+ * Fix - Issue with variable products syncing to FB product sets.
6
+ * Fix - Scheduled job logs written to options table are never removed if job does not complete.
7
+ * Fix - User-Agent to contain English extension name.
8
+ * Fix - clear out wc_facebook_external_business_id option on disconnect.
9
+ * Fix - fix product title length check to account for encoding.
10
+ * Tweak - Use `Automattic\WooCommerce\Admin\Features\Features::is_enabled` instead of the deprecated `WooCommerce\Admin\Loader::is_feature_enabled`.
11
+
12
  2022-03-08 - version 2.6.12
13
  * Add - Filter to change Facebook Retailer ID, wc_facebook_fb_retailer_id.
14
 
class-wc-facebookcommerce.php CHANGED
@@ -17,6 +17,7 @@ use SkyVerge\WooCommerce\Facebook\Utilities\Background_Remove_Duplicate_Visibili
17
  use SkyVerge\WooCommerce\PluginFramework\v5_10_0 as Framework;
18
  use SkyVerge\WooCommerce\Facebook\ProductSync\ProductValidator as ProductSyncValidator;
19
  use SkyVerge\WooCommerce\Facebook\Utilities\Heartbeat;
 
20
 
21
  if ( ! class_exists( 'WC_Facebookcommerce' ) ) :
22
 
@@ -40,6 +41,8 @@ if ( ! class_exists( 'WC_Facebookcommerce' ) ) :
40
  /** @var string the product set categories meta name */
41
  const PRODUCT_SET_META = '_wc_facebook_product_cats';
42
 
 
 
43
 
44
  /** @var \WC_Facebookcommerce singleton instance */
45
  protected static $instance;
@@ -134,6 +137,11 @@ if ( ! class_exists( 'WC_Facebookcommerce' ) ) :
134
  add_filter( 'woocommerce_navigation_is_connected_page', array( $this, 'is_current_page_conected_filter' ), 99, 2 );
135
  add_filter( 'woocommerce_navigation_get_breadcrumbs', array( $this, 'wc_page_breadcrumbs_filter' ), 99 );
136
 
 
 
 
 
 
137
  if ( \WC_Facebookcommerce_Utils::isWoocommerceIntegration() ) {
138
  require_once __DIR__ . '/vendor/autoload.php';
139
 
@@ -374,8 +382,12 @@ if ( ! class_exists( 'WC_Facebookcommerce' ) ) :
374
 
375
  if ( Framework\SV_WC_Plugin_Compatibility::is_enhanced_admin_available() ) {
376
 
377
- $is_marketing_enabled = is_callable( 'Automattic\WooCommerce\Admin\Loader::is_feature_enabled' )
378
- && Automattic\WooCommerce\Admin\Loader::is_feature_enabled( 'marketing' );
 
 
 
 
379
 
380
  if ( $is_marketing_enabled ) {
381
 
@@ -577,6 +589,30 @@ if ( ! class_exists( 'WC_Facebookcommerce' ) ) :
577
  return $is_conected;
578
  }
579
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
580
 
581
  /** Getter methods ********************************************************************************************/
582
 
17
  use SkyVerge\WooCommerce\PluginFramework\v5_10_0 as Framework;
18
  use SkyVerge\WooCommerce\Facebook\ProductSync\ProductValidator as ProductSyncValidator;
19
  use SkyVerge\WooCommerce\Facebook\Utilities\Heartbeat;
20
+ use Automattic\WooCommerce\Admin\Features\Features as WooAdminFeatures;
21
 
22
  if ( ! class_exists( 'WC_Facebookcommerce' ) ) :
23
 
41
  /** @var string the product set categories meta name */
42
  const PRODUCT_SET_META = '_wc_facebook_product_cats';
43
 
44
+ /** @var string the plugin user agent name to use for HTTP calls within User-Agent header */
45
+ const PLUGIN_USER_AGENT_NAME = 'Facebook-for-WooCommerce';
46
 
47
  /** @var \WC_Facebookcommerce singleton instance */
48
  protected static $instance;
137
  add_filter( 'woocommerce_navigation_is_connected_page', array( $this, 'is_current_page_conected_filter' ), 99, 2 );
138
  add_filter( 'woocommerce_navigation_get_breadcrumbs', array( $this, 'wc_page_breadcrumbs_filter' ), 99 );
139
 
140
+ add_filter(
141
+ 'wc_' . WC_Facebookcommerce::PLUGIN_ID . '_http_request_args',
142
+ array( $this, 'force_user_agent_in_latin' )
143
+ );
144
+
145
  if ( \WC_Facebookcommerce_Utils::isWoocommerceIntegration() ) {
146
  require_once __DIR__ . '/vendor/autoload.php';
147
 
382
 
383
  if ( Framework\SV_WC_Plugin_Compatibility::is_enhanced_admin_available() ) {
384
 
385
+ if ( class_exists( WooAdminFeatures::class ) ) {
386
+ $is_marketing_enabled = WooAdminFeatures::is_enabled( 'marketing' );
387
+ } else {
388
+ $is_marketing_enabled = is_callable( '\Automattic\WooCommerce\Admin\Loader::is_feature_enabled' )
389
+ && \Automattic\WooCommerce\Admin\Loader::is_feature_enabled( 'marketing' );
390
+ }
391
 
392
  if ( $is_marketing_enabled ) {
393
 
589
  return $is_conected;
590
  }
591
 
592
+ /**
593
+ * Filter is responsible to always set latin user agent header value, because translated plugin names
594
+ * may contain characters which Facebook does not accept and return 400 response for requests with such
595
+ * header values.
596
+ * Applying either sanitize_title() nor remove_accents() on header value will not work for all the languages
597
+ * we support translations to e.g. Hebrew is going to convert into something %d7%90%d7%a8%d7%99%d7%92 which is
598
+ * not acceptable neither.
599
+ *
600
+ * @param array $http_request_headers - http request headers
601
+ * @return array
602
+ */
603
+ public function force_user_agent_in_latin( array $http_request_headers ) {
604
+ if ( isset( $http_request_headers['user-agent'] ) ) {
605
+ $http_request_headers['user-agent'] = sprintf(
606
+ '%s/%s (WooCommerce/%s; WordPress/%s)',
607
+ WC_Facebookcommerce::PLUGIN_USER_AGENT_NAME,
608
+ WC_Facebookcommerce::PLUGIN_VERSION,
609
+ defined( 'WC_VERSION' ) ? WC_VERSION : WC_Facebook_Loader::MINIMUM_WC_VERSION,
610
+ $GLOBALS['wp_version']
611
+ );
612
+ }
613
+ return $http_request_headers;
614
+ }
615
+
616
 
617
  /** Getter methods ********************************************************************************************/
618
 
facebook-for-woocommerce.php CHANGED
@@ -11,7 +11,7 @@
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.12
15
  * Text Domain: facebook-for-woocommerce
16
  * Tested up to: 5.9
17
  * WC requires at least: 3.5.0
@@ -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.12'; // 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.13
15
  * Text Domain: facebook-for-woocommerce
16
  * Tested up to: 5.9
17
  * WC requires at least: 3.5.0
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.13'; // 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.12\n"
6
  "Report-Msgid-Bugs-To: "
7
  "https://woocommerce.com/my-account/marketplace-ticket-form/\n"
8
- "POT-Creation-Date: 2022-03-08 11:07:47+00:00\n"
9
  "MIME-Version: 1.0\n"
10
  "Content-Type: text/plain; charset=utf-8\n"
11
  "Content-Transfer-Encoding: 8bit\n"
@@ -13,7 +13,7 @@ msgstr ""
13
  "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
14
  "Language-Team: LANGUAGE <LL@li.org>\n"
15
 
16
- #: class-wc-facebookcommerce.php:263
17
  #. translators: Placeholders %1$s - opening strong HTML tag, %2$s - closing
18
  #. strong HTML tag, %3$s - opening link HTML tag, %4$s - closing link HTML tag
19
  msgid ""
@@ -21,7 +21,7 @@ msgid ""
21
  "Facebook for WooCommerce connection. Please %3$sclick here%4$s to reconnect!"
22
  msgstr ""
23
 
24
- #: class-wc-facebookcommerce.php:284
25
  #. translators: Placeholders %1$s - opening link HTML tag, %2$s - closing link
26
  #. HTML tag
27
  msgid ""
@@ -29,7 +29,7 @@ msgid ""
29
  "under %1$sWooCommerce > Facebook%2$s."
30
  msgstr ""
31
 
32
- #: class-wc-facebookcommerce.php:304
33
  #. translators: Placeholders %1$s - opening strong HTML tag, %2$s - closing
34
  #. strong HTML tag, %3$s - opening link HTML tag, %4$s - closing link HTML tag
35
  msgid ""
@@ -37,7 +37,7 @@ msgid ""
37
  "configuration, %3$scomplete the setup steps%4$s."
38
  msgstr ""
39
 
40
- #: class-wc-facebookcommerce.php:336
41
  #. translators: Placeholders: %1$s - <strong> tag, %2$s - </strong> tag, %3$s -
42
  #. <a> tag, %4$s - </a> tag
43
  msgid ""
@@ -46,7 +46,7 @@ msgid ""
46
  "Connection%4$s area."
47
  msgstr ""
48
 
49
- #: class-wc-facebookcommerce.php:359
50
  #. translators: Placeholders: %1$s - <strong> tag, %2$s - </strong> tag, %3$s -
51
  #. <a> tag, %4$s - </a> tag
52
  msgid ""
@@ -55,51 +55,51 @@ msgid ""
55
  "products."
56
  msgstr ""
57
 
58
- #: class-wc-facebookcommerce.php:385
59
  #. translators: Placeholders: %1$s - opening <a> HTML link tag, %2$s - closing
60
  #. </a> HTML link tag
61
  msgid "Heads up! The Facebook menu is now located under the %1$sMarketing%2$s menu."
62
  msgstr ""
63
 
64
- #: class-wc-facebookcommerce.php:467
65
  msgid "FB Product Sets"
66
  msgstr ""
67
 
68
- #: class-wc-facebookcommerce.php:468
69
  msgid "FB Product Set"
70
  msgstr ""
71
 
72
- #: class-wc-facebookcommerce.php:476
73
  #. translators: Edit item label
74
  msgid "Edit %s"
75
  msgstr ""
76
 
77
- #: class-wc-facebookcommerce.php:478
78
  #. translators: Add new label
79
  msgid "Add new %s"
80
  msgstr ""
81
 
82
- #: class-wc-facebookcommerce.php:481
83
  #. translators: No items found text
84
  msgid "No %s found."
85
  msgstr ""
86
 
87
- #: class-wc-facebookcommerce.php:483
88
  #. translators: Search label
89
  msgid "Search %s."
90
  msgstr ""
91
 
92
- #: class-wc-facebookcommerce.php:485
93
  #. translators: Text label
94
  msgid "Separate %s with commas"
95
  msgstr ""
96
 
97
- #: class-wc-facebookcommerce.php:487
98
  #. translators: Text label
99
  msgid "Choose from the most used %s"
100
  msgstr ""
101
 
102
- #: class-wc-facebookcommerce.php:603
103
  msgid "Cannot create the API instance because the access token is missing."
104
  msgstr ""
105
 
@@ -385,20 +385,20 @@ msgstr ""
385
  msgid "Facebook"
386
  msgstr ""
387
 
388
- #: includes/Admin/Settings.php:121
389
  #: includes/Admin/Settings_Screens/Connection.php:35
390
  #: includes/Admin/Settings_Screens/Connection.php:36
391
  msgid "Connection"
392
  msgstr ""
393
 
394
- #: includes/Admin/Settings.php:124
395
  #: includes/Admin/Settings_Screens/Messenger.php:41
396
  #: includes/Admin/Settings_Screens/Messenger.php:42
397
  #: includes/Admin/Settings_Screens/Messenger.php:148
398
  msgid "Messenger"
399
  msgstr ""
400
 
401
- #: includes/Admin/Settings.php:127
402
  #: includes/Admin/Settings_Screens/Product_Sync.php:43
403
  #: includes/Admin/Settings_Screens/Product_Sync.php:44
404
  #: includes/Admin/Settings_Screens/Product_Sync.php:181
@@ -406,21 +406,21 @@ msgstr ""
406
  msgid "Product sync"
407
  msgstr ""
408
 
409
- #: includes/Admin/Settings.php:130
410
  #: includes/Admin/Settings_Screens/Advertise.php:38
411
  #: includes/Admin/Settings_Screens/Advertise.php:39
412
  msgid "Advertise"
413
  msgstr ""
414
 
415
- #: includes/Admin/Settings.php:216
416
  msgid "You do not have permission to save these settings."
417
  msgstr ""
418
 
419
- #: includes/Admin/Settings.php:225
420
  msgid "Your settings have been saved."
421
  msgstr ""
422
 
423
- #: includes/Admin/Settings.php:232
424
  #. translators: Placeholders: %s - user-friendly error message
425
  msgid "Your settings could not be saved. %s"
426
  msgstr ""
@@ -988,17 +988,17 @@ msgstr ""
988
  msgid "Disconnection successful."
989
  msgstr ""
990
 
991
- #: includes/Handlers/Connection.php:456
992
  #. translators: Placeholders: %s - API error message
993
  msgid "Could not retrieve page access data. %s"
994
  msgstr ""
995
 
996
- #: includes/Handlers/Connection.php:470
997
  #. translators: Placeholders: %s - Facebook page ID
998
  msgid "Page %s not authorized."
999
  msgstr ""
1000
 
1001
- #: includes/Handlers/Connection.php:1430
1002
  msgid "You do not have permission to finish App Store login."
1003
  msgstr ""
1004
 
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.13\n"
6
  "Report-Msgid-Bugs-To: "
7
  "https://woocommerce.com/my-account/marketplace-ticket-form/\n"
8
+ "POT-Creation-Date: 2022-04-26 10:28:01+00:00\n"
9
  "MIME-Version: 1.0\n"
10
  "Content-Type: text/plain; charset=utf-8\n"
11
  "Content-Transfer-Encoding: 8bit\n"
13
  "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
14
  "Language-Team: LANGUAGE <LL@li.org>\n"
15
 
16
+ #: class-wc-facebookcommerce.php:271
17
  #. translators: Placeholders %1$s - opening strong HTML tag, %2$s - closing
18
  #. strong HTML tag, %3$s - opening link HTML tag, %4$s - closing link HTML tag
19
  msgid ""
21
  "Facebook for WooCommerce connection. Please %3$sclick here%4$s to reconnect!"
22
  msgstr ""
23
 
24
+ #: class-wc-facebookcommerce.php:292
25
  #. translators: Placeholders %1$s - opening link HTML tag, %2$s - closing link
26
  #. HTML tag
27
  msgid ""
29
  "under %1$sWooCommerce > Facebook%2$s."
30
  msgstr ""
31
 
32
+ #: class-wc-facebookcommerce.php:312
33
  #. translators: Placeholders %1$s - opening strong HTML tag, %2$s - closing
34
  #. strong HTML tag, %3$s - opening link HTML tag, %4$s - closing link HTML tag
35
  msgid ""
37
  "configuration, %3$scomplete the setup steps%4$s."
38
  msgstr ""
39
 
40
+ #: class-wc-facebookcommerce.php:344
41
  #. translators: Placeholders: %1$s - <strong> tag, %2$s - </strong> tag, %3$s -
42
  #. <a> tag, %4$s - </a> tag
43
  msgid ""
46
  "Connection%4$s area."
47
  msgstr ""
48
 
49
+ #: class-wc-facebookcommerce.php:367
50
  #. translators: Placeholders: %1$s - <strong> tag, %2$s - </strong> tag, %3$s -
51
  #. <a> tag, %4$s - </a> tag
52
  msgid ""
55
  "products."
56
  msgstr ""
57
 
58
+ #: class-wc-facebookcommerce.php:397
59
  #. translators: Placeholders: %1$s - opening <a> HTML link tag, %2$s - closing
60
  #. </a> HTML link tag
61
  msgid "Heads up! The Facebook menu is now located under the %1$sMarketing%2$s menu."
62
  msgstr ""
63
 
64
+ #: class-wc-facebookcommerce.php:479
65
  msgid "FB Product Sets"
66
  msgstr ""
67
 
68
+ #: class-wc-facebookcommerce.php:480
69
  msgid "FB Product Set"
70
  msgstr ""
71
 
72
+ #: class-wc-facebookcommerce.php:488
73
  #. translators: Edit item label
74
  msgid "Edit %s"
75
  msgstr ""
76
 
77
+ #: class-wc-facebookcommerce.php:490
78
  #. translators: Add new label
79
  msgid "Add new %s"
80
  msgstr ""
81
 
82
+ #: class-wc-facebookcommerce.php:493
83
  #. translators: No items found text
84
  msgid "No %s found."
85
  msgstr ""
86
 
87
+ #: class-wc-facebookcommerce.php:495
88
  #. translators: Search label
89
  msgid "Search %s."
90
  msgstr ""
91
 
92
+ #: class-wc-facebookcommerce.php:497
93
  #. translators: Text label
94
  msgid "Separate %s with commas"
95
  msgstr ""
96
 
97
+ #: class-wc-facebookcommerce.php:499
98
  #. translators: Text label
99
  msgid "Choose from the most used %s"
100
  msgstr ""
101
 
102
+ #: class-wc-facebookcommerce.php:639
103
  msgid "Cannot create the API instance because the access token is missing."
104
  msgstr ""
105
 
385
  msgid "Facebook"
386
  msgstr ""
387
 
388
+ #: includes/Admin/Settings.php:125
389
  #: includes/Admin/Settings_Screens/Connection.php:35
390
  #: includes/Admin/Settings_Screens/Connection.php:36
391
  msgid "Connection"
392
  msgstr ""
393
 
394
+ #: includes/Admin/Settings.php:128
395
  #: includes/Admin/Settings_Screens/Messenger.php:41
396
  #: includes/Admin/Settings_Screens/Messenger.php:42
397
  #: includes/Admin/Settings_Screens/Messenger.php:148
398
  msgid "Messenger"
399
  msgstr ""
400
 
401
+ #: includes/Admin/Settings.php:131
402
  #: includes/Admin/Settings_Screens/Product_Sync.php:43
403
  #: includes/Admin/Settings_Screens/Product_Sync.php:44
404
  #: includes/Admin/Settings_Screens/Product_Sync.php:181
406
  msgid "Product sync"
407
  msgstr ""
408
 
409
+ #: includes/Admin/Settings.php:134
410
  #: includes/Admin/Settings_Screens/Advertise.php:38
411
  #: includes/Admin/Settings_Screens/Advertise.php:39
412
  msgid "Advertise"
413
  msgstr ""
414
 
415
+ #: includes/Admin/Settings.php:220
416
  msgid "You do not have permission to save these settings."
417
  msgstr ""
418
 
419
+ #: includes/Admin/Settings.php:229
420
  msgid "Your settings have been saved."
421
  msgstr ""
422
 
423
+ #: includes/Admin/Settings.php:236
424
  #. translators: Placeholders: %s - user-friendly error message
425
  msgid "Your settings could not be saved. %s"
426
  msgstr ""
988
  msgid "Disconnection successful."
989
  msgstr ""
990
 
991
+ #: includes/Handlers/Connection.php:459
992
  #. translators: Placeholders: %s - API error message
993
  msgid "Could not retrieve page access data. %s"
994
  msgstr ""
995
 
996
+ #: includes/Handlers/Connection.php:473
997
  #. translators: Placeholders: %s - Facebook page ID
998
  msgid "Page %s not authorized."
999
  msgstr ""
1000
 
1001
+ #: includes/Handlers/Connection.php:1446
1002
  msgid "You do not have permission to finish App Store login."
1003
  msgstr ""
1004
 
includes/Admin/Settings.php CHANGED
@@ -60,7 +60,6 @@ class Settings {
60
 
61
  add_action( 'wp_loaded', array( $this, 'save' ) );
62
 
63
- $this->use_woo_nav = class_exists( WooAdminFeatures::class ) && class_exists( WooAdminMenu::class ) && WooAdminFeatures::is_enabled( 'navigation' );
64
  }
65
 
66
 
@@ -73,11 +72,16 @@ class Settings {
73
 
74
  $root_menu_item = 'woocommerce';
75
  $is_marketing_enabled = false;
 
76
 
77
  if ( Framework\SV_WC_Plugin_Compatibility::is_enhanced_admin_available() ) {
78
 
79
- $is_marketing_enabled = is_callable( '\Automattic\WooCommerce\Admin\Loader::is_feature_enabled' )
80
- && \Automattic\WooCommerce\Admin\Loader::is_feature_enabled( 'marketing' );
 
 
 
 
81
 
82
  if ( $is_marketing_enabled ) {
83
 
60
 
61
  add_action( 'wp_loaded', array( $this, 'save' ) );
62
 
 
63
  }
64
 
65
 
72
 
73
  $root_menu_item = 'woocommerce';
74
  $is_marketing_enabled = false;
75
+ $this->use_woo_nav = class_exists( WooAdminFeatures::class ) && class_exists( WooAdminMenu::class ) && WooAdminFeatures::is_enabled( 'navigation' );
76
 
77
  if ( Framework\SV_WC_Plugin_Compatibility::is_enhanced_admin_available() ) {
78
 
79
+ if ( class_exists( WooAdminFeatures::class ) ) {
80
+ $is_marketing_enabled = WooAdminFeatures::is_enabled( 'marketing' );
81
+ } else {
82
+ $is_marketing_enabled = is_callable( '\Automattic\WooCommerce\Admin\Loader::is_feature_enabled' )
83
+ && \Automattic\WooCommerce\Admin\Loader::is_feature_enabled( 'marketing' );
84
+ }
85
 
86
  if ( $is_marketing_enabled ) {
87
 
includes/Handlers/Connection.php CHANGED
@@ -417,12 +417,15 @@ class Connection {
417
  $this->update_ad_account_id( '' );
418
  $this->update_instagram_business_id( '' );
419
  $this->update_commerce_merchant_settings_id( '' );
 
420
 
421
  update_option( \WC_Facebookcommerce_Integration::SETTING_FACEBOOK_PAGE_ID, '' );
422
  update_option( \WC_Facebookcommerce_Integration::SETTING_FACEBOOK_PIXEL_ID, '' );
 
423
  facebook_for_woocommerce()->get_integration()->update_product_catalog_id( '' );
424
 
425
  delete_transient( 'wc_facebook_business_configuration_refresh' );
 
426
  }
427
 
428
 
@@ -688,7 +691,7 @@ class Connection {
688
 
689
  $external_id = get_option( self::OPTION_EXTERNAL_BUSINESS_ID );
690
 
691
- if ( ! is_string( $external_id ) ) {
692
 
693
  /**
694
  * Filters the shop's business external ID.
@@ -708,7 +711,8 @@ class Connection {
708
 
709
  $external_id = uniqid( sprintf( '%s-', $external_id ), false );
710
 
711
- update_option( self::OPTION_EXTERNAL_BUSINESS_ID, $external_id );
 
712
  }
713
 
714
  $this->external_business_id = $external_id;
@@ -1146,6 +1150,18 @@ class Connection {
1146
  update_option( self::OPTION_PAGE_ACCESS_TOKEN, is_string( $value ) ? $value : '' );
1147
  }
1148
 
 
 
 
 
 
 
 
 
 
 
 
 
1149
 
1150
  /**
1151
  * Determines whether the site is connected.
@@ -1304,7 +1320,7 @@ class Connection {
1304
  }
1305
 
1306
  if ( ! empty( $values->business_id ) ) {
1307
- update_option( self::OPTION_EXTERNAL_BUSINESS_ID, sanitize_text_field( $values->business_id ) );
1308
  $log_data[ self::OPTION_EXTERNAL_BUSINESS_ID ] = sanitize_text_field( $values->business_id );
1309
  }
1310
 
417
  $this->update_ad_account_id( '' );
418
  $this->update_instagram_business_id( '' );
419
  $this->update_commerce_merchant_settings_id( '' );
420
+ $this->update_external_business_id('');
421
 
422
  update_option( \WC_Facebookcommerce_Integration::SETTING_FACEBOOK_PAGE_ID, '' );
423
  update_option( \WC_Facebookcommerce_Integration::SETTING_FACEBOOK_PIXEL_ID, '' );
424
+
425
  facebook_for_woocommerce()->get_integration()->update_product_catalog_id( '' );
426
 
427
  delete_transient( 'wc_facebook_business_configuration_refresh' );
428
+
429
  }
430
 
431
 
691
 
692
  $external_id = get_option( self::OPTION_EXTERNAL_BUSINESS_ID );
693
 
694
+ if ( ! is_string( $external_id ) || empty( $external_id ) ) {
695
 
696
  /**
697
  * Filters the shop's business external ID.
711
 
712
  $external_id = uniqid( sprintf( '%s-', $external_id ), false );
713
 
714
+ $this->update_external_business_id( $external_id );
715
+
716
  }
717
 
718
  $this->external_business_id = $external_id;
1150
  update_option( self::OPTION_PAGE_ACCESS_TOKEN, is_string( $value ) ? $value : '' );
1151
  }
1152
 
1153
+ /**
1154
+ * Stores the given external business id.
1155
+ *
1156
+ * @since 2.6.13
1157
+ *
1158
+ * @param string $value external business id
1159
+ */
1160
+ public function update_external_business_id( $value ) {
1161
+
1162
+ update_option( self::OPTION_EXTERNAL_BUSINESS_ID, is_string( $value ) ? $value : '' );
1163
+ }
1164
+
1165
 
1166
  /**
1167
  * Determines whether the site is connected.
1320
  }
1321
 
1322
  if ( ! empty( $values->business_id ) ) {
1323
+ $this->update_external_business_id( sanitize_text_field( $values->business_id ) );
1324
  $log_data[ self::OPTION_EXTERNAL_BUSINESS_ID ] = sanitize_text_field( $values->business_id );
1325
  }
1326
 
includes/Jobs/CleanupSkyvergeFrameworkJobOptions.php CHANGED
@@ -9,7 +9,7 @@ defined( 'ABSPATH' ) || exit;
9
  /**
10
  * Class CleanupSkyvergeFrameworkJobOptions
11
  *
12
- * Responsible for cleaning up old completed background sync jobs from SkyVerge background job system.
13
  * Each job is represented by a row in wp_options table, and these can accumulate over time.
14
  *
15
  * Note - this is closely coupled to the SkyVerge background job system, and is essentially a patch to improve it.
@@ -29,7 +29,7 @@ class CleanupSkyvergeFrameworkJobOptions {
29
  }
30
 
31
  /**
32
- * Delete old completed product sync job rows from options table.
33
  *
34
  * Logic and database query are adapted from SV_WP_Background_Job_Handler::get_jobs().
35
  *
@@ -42,7 +42,7 @@ class CleanupSkyvergeFrameworkJobOptions {
42
  /**
43
  * Query notes:
44
  * - Matching product sync job only (Products\Sync\Background class).
45
- * - Matching "completed" status by sniffing json option value.
46
  * - Order by lowest id, to delete older rows first.
47
  * - Limit number of rows (periodic task will eventually remove all).
48
  * Using `get_results` so we can limit number of items; `delete` doesn't allow this.
@@ -51,9 +51,9 @@ class CleanupSkyvergeFrameworkJobOptions {
51
  "DELETE
52
  FROM {$wpdb->options}
53
  WHERE option_name LIKE 'wc_facebook_background_product_sync_job_%'
54
- AND option_value LIKE '%\"status\":\"completed\"%'
55
  ORDER BY option_id ASC
56
- LIMIT 250"
57
  );
58
  }
59
 
9
  /**
10
  * Class CleanupSkyvergeFrameworkJobOptions
11
  *
12
+ * Responsible for cleaning up old completed and failed background sync jobs from SkyVerge background job system.
13
  * Each job is represented by a row in wp_options table, and these can accumulate over time.
14
  *
15
  * Note - this is closely coupled to the SkyVerge background job system, and is essentially a patch to improve it.
29
  }
30
 
31
  /**
32
+ * Delete old completed/failed product sync job rows from options table.
33
  *
34
  * Logic and database query are adapted from SV_WP_Background_Job_Handler::get_jobs().
35
  *
42
  /**
43
  * Query notes:
44
  * - Matching product sync job only (Products\Sync\Background class).
45
+ * - Matching "completed" or "failed" status by sniffing json option value.
46
  * - Order by lowest id, to delete older rows first.
47
  * - Limit number of rows (periodic task will eventually remove all).
48
  * Using `get_results` so we can limit number of items; `delete` doesn't allow this.
51
  "DELETE
52
  FROM {$wpdb->options}
53
  WHERE option_name LIKE 'wc_facebook_background_product_sync_job_%'
54
+ AND ( option_value LIKE '%\"status\":\"completed\"%' OR option_value LIKE '%\"status\":\"failed\"%' )
55
  ORDER BY option_id ASC
56
+ LIMIT 500"
57
  );
58
  }
59
 
includes/ProductSets/Sync.php CHANGED
@@ -357,7 +357,13 @@ class Sync {
357
 
358
  // gets products variations
359
  global $wpdb;
360
- $variation_ids = $wpdb->get_results( $wpdb->prepare( "SELECT ID FROM $wpdb->posts WHERE post_type = 'product_variation' AND post_parent IN (%s) ", implode( ',', $product_ids ) ) );
 
 
 
 
 
 
361
  if ( ! empty( $variation_ids ) ) {
362
 
363
  // product_variations: add retailer id to the products filter
357
 
358
  // gets products variations
359
  global $wpdb;
360
+
361
+ $sql = sprintf(
362
+ "SELECT ID FROM $wpdb->posts WHERE post_type = 'product_variation' AND post_parent IN (%s) ",
363
+ implode( ', ', array_map( 'intval', $product_ids ) )
364
+ );
365
+
366
+ $variation_ids = $wpdb->get_results( $sql );
367
  if ( ! empty( $variation_ids ) ) {
368
 
369
  // product_variations: add retailer id to the products filter
includes/ProductSync/ProductValidator.php CHANGED
@@ -349,7 +349,7 @@ class ProductValidator {
349
  if ( \WC_Facebookcommerce_Utils::is_all_caps( $title ) ) {
350
  throw new ProductInvalidException( __( 'Product title is all capital letters. Please change the title to sentence case in order to allow synchronization of your product.', 'facebook-for-woocommerce' ) );
351
  }
352
- if ( strlen( $title ) > self::MAX_TITLE_LENGTH ) {
353
  throw new ProductInvalidException( __( 'Product title is too long. Maximum allowed length is 150 characters.', 'facebook-for-woocommerce' ) );
354
  }
355
  }
349
  if ( \WC_Facebookcommerce_Utils::is_all_caps( $title ) ) {
350
  throw new ProductInvalidException( __( 'Product title is all capital letters. Please change the title to sentence case in order to allow synchronization of your product.', 'facebook-for-woocommerce' ) );
351
  }
352
+ if ( mb_strlen( $title, 'UTF-8' ) > self::MAX_TITLE_LENGTH ) {
353
  throw new ProductInvalidException( __( 'Product title is too long. Maximum allowed length is 150 characters.', 'facebook-for-woocommerce' ) );
354
  }
355
  }
readme.txt CHANGED
@@ -3,7 +3,7 @@ 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.12
7
  Requires PHP: 5.6 or greater
8
  MySQL: 5.6 or greater
9
  License: GPLv2 or later
@@ -39,6 +39,15 @@ When opening a bug on GitHub, please give us as many details as possible.
39
 
40
  == Changelog ==
41
 
 
 
 
 
 
 
 
 
 
42
  = 2.6.12 - 2022-03-08 =
43
  * Add - Filter to change Facebook Retailer ID, wc_facebook_fb_retailer_id.
44
 
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.13
7
  Requires PHP: 5.6 or greater
8
  MySQL: 5.6 or greater
9
  License: GPLv2 or later
39
 
40
  == Changelog ==
41
 
42
+ = 2.6.13 - 2022-04-26 =
43
+ * Fix - Issue with Facebook not displayed in the new WC navigation.
44
+ * Fix - Issue with variable products syncing to FB product sets.
45
+ * Fix - Scheduled job logs written to options table are never removed if job does not complete.
46
+ * Fix - User-Agent to contain English extension name.
47
+ * Fix - clear out wc_facebook_external_business_id option on disconnect.
48
+ * Fix - fix product title length check to account for encoding.
49
+ * Tweak - Use `Automattic\WooCommerce\Admin\Features\Features::is_enabled` instead of the deprecated `WooCommerce\Admin\Loader::is_feature_enabled`.
50
+
51
  = 2.6.12 - 2022-03-08 =
52
  * Add - Filter to change Facebook Retailer ID, wc_facebook_fb_retailer_id.
53
 
vendor/autoload.php CHANGED
@@ -4,4 +4,4 @@
4
 
5
  require_once __DIR__ . '/composer/autoload_real.php';
6
 
7
- return ComposerAutoloaderInitf03e6f09f2bb29476a766a6a860bc6dc::getLoader();
4
 
5
  require_once __DIR__ . '/composer/autoload_real.php';
6
 
7
+ return ComposerAutoloaderInita2b43888cea4bd45e93809d03e360862::getLoader();
vendor/composer/ClassLoader.php CHANGED
@@ -149,7 +149,7 @@ class ClassLoader
149
 
150
  /**
151
  * @return string[] Array of classname => path
152
- * @psalm-var array<string, string>
153
  */
154
  public function getClassMap()
155
  {
149
 
150
  /**
151
  * @return string[] Array of classname => path
152
+ * @psalm-return array<string, string>
153
  */
154
  public function getClassMap()
155
  {
vendor/composer/autoload_real.php CHANGED
@@ -2,7 +2,7 @@
2
 
3
  // autoload_real.php @generated by Composer
4
 
5
- class ComposerAutoloaderInitf03e6f09f2bb29476a766a6a860bc6dc
6
  {
7
  private static $loader;
8
 
@@ -24,15 +24,15 @@ class ComposerAutoloaderInitf03e6f09f2bb29476a766a6a860bc6dc
24
 
25
  require __DIR__ . '/platform_check.php';
26
 
27
- spl_autoload_register(array('ComposerAutoloaderInitf03e6f09f2bb29476a766a6a860bc6dc', 'loadClassLoader'), true, true);
28
  self::$loader = $loader = new \Composer\Autoload\ClassLoader(\dirname(\dirname(__FILE__)));
29
- spl_autoload_unregister(array('ComposerAutoloaderInitf03e6f09f2bb29476a766a6a860bc6dc', '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\ComposerStaticInitf03e6f09f2bb29476a766a6a860bc6dc::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 ComposerAutoloaderInita2b43888cea4bd45e93809d03e360862
6
  {
7
  private static $loader;
8
 
24
 
25
  require __DIR__ . '/platform_check.php';
26
 
27
+ spl_autoload_register(array('ComposerAutoloaderInita2b43888cea4bd45e93809d03e360862', 'loadClassLoader'), true, true);
28
  self::$loader = $loader = new \Composer\Autoload\ClassLoader(\dirname(\dirname(__FILE__)));
29
+ spl_autoload_unregister(array('ComposerAutoloaderInita2b43888cea4bd45e93809d03e360862', '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\ComposerStaticInita2b43888cea4bd45e93809d03e360862::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 ComposerStaticInitf03e6f09f2bb29476a766a6a860bc6dc
8
  {
9
  public static $prefixLengthsPsr4 = array (
10
  'S' =>
@@ -43,9 +43,9 @@ class ComposerStaticInitf03e6f09f2bb29476a766a6a860bc6dc
43
  public static function getInitializer(ClassLoader $loader)
44
  {
45
  return \Closure::bind(function () use ($loader) {
46
- $loader->prefixLengthsPsr4 = ComposerStaticInitf03e6f09f2bb29476a766a6a860bc6dc::$prefixLengthsPsr4;
47
- $loader->prefixDirsPsr4 = ComposerStaticInitf03e6f09f2bb29476a766a6a860bc6dc::$prefixDirsPsr4;
48
- $loader->classMap = ComposerStaticInitf03e6f09f2bb29476a766a6a860bc6dc::$classMap;
49
 
50
  }, null, ClassLoader::class);
51
  }
4
 
5
  namespace Composer\Autoload;
6
 
7
+ class ComposerStaticInita2b43888cea4bd45e93809d03e360862
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 = ComposerStaticInita2b43888cea4bd45e93809d03e360862::$prefixLengthsPsr4;
47
+ $loader->prefixDirsPsr4 = ComposerStaticInita2b43888cea4bd45e93809d03e360862::$prefixDirsPsr4;
48
+ $loader->classMap = ComposerStaticInita2b43888cea4bd45e93809d03e360862::$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.12',
4
- 'version' => 'dev-release/2.6.12',
5
  'type' => 'wordpress-plugin',
6
  'install_path' => __DIR__ . '/../../',
7
  'aliases' => array(),
8
- 'reference' => 'c37386d4b64689132c81c11cdef5d5e921eacb1e',
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.12',
24
- 'version' => 'dev-release/2.6.12',
25
  'type' => 'wordpress-plugin',
26
  'install_path' => __DIR__ . '/../../',
27
  'aliases' => array(),
28
- 'reference' => 'c37386d4b64689132c81c11cdef5d5e921eacb1e',
29
  'dev_requirement' => false,
30
  ),
31
  'roundcube/plugin-installer' => array(
1
  <?php return array(
2
  'root' => array(
3
+ 'pretty_version' => 'dev-release/2.6.13',
4
+ 'version' => 'dev-release/2.6.13',
5
  'type' => 'wordpress-plugin',
6
  'install_path' => __DIR__ . '/../../',
7
  'aliases' => array(),
8
+ 'reference' => 'a16bf14687848fda8415af4653303908c849c655',
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.13',
24
+ 'version' => 'dev-release/2.6.13',
25
  'type' => 'wordpress-plugin',
26
  'install_path' => __DIR__ . '/../../',
27
  'aliases' => array(),
28
+ 'reference' => 'a16bf14687848fda8415af4653303908c849c655',
29
  'dev_requirement' => false,
30
  ),
31
  'roundcube/plugin-installer' => array(