Facebook for WooCommerce - Version 2.3.2

Version Description

Download this release

Release Info

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

Code changes from version 2.3.1 to 2.3.2

changelog.txt CHANGED
@@ -1,5 +1,8 @@
1
  *** Facebook for WooCommerce Changelog ***
2
 
 
 
 
3
  2021.02.23 - version 2.3.1
4
  * Fix - Fix errors when product set is empty
5
  * Fix - Ensure that events have an action_source
1
  *** Facebook for WooCommerce Changelog ***
2
 
3
+ 2021.03.02 - version 2.3.2
4
+ * Tweak - Bump Facebook Marketing API version to 9.0
5
+
6
  2021.02.23 - version 2.3.1
7
  * Fix - Fix errors when product set is empty
8
  * Fix - Ensure that events have an action_source
class-wc-facebookcommerce.php CHANGED
@@ -22,7 +22,7 @@ if ( ! class_exists( 'WC_Facebookcommerce' ) ) :
22
 
23
 
24
  /** @var string the plugin version */
25
- const VERSION = '2.3.1';
26
 
27
  /** @var string for backwards compatibility TODO: remove this in v2.0.0 {CW 2020-02-06} */
28
  const PLUGIN_VERSION = self::VERSION;
22
 
23
 
24
  /** @var string the plugin version */
25
+ const VERSION = '2.3.2';
26
 
27
  /** @var string for backwards compatibility TODO: remove this in v2.0.0 {CW 2020-02-06} */
28
  const PLUGIN_VERSION = self::VERSION;
facebook-for-woocommerce.php CHANGED
@@ -10,7 +10,7 @@
10
  * 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.
11
  * Author: Facebook
12
  * Author URI: https://www.facebook.com/
13
- * Version: 2.3.1
14
  * Text Domain: facebook-for-woocommerce
15
  * WC requires at least: 3.5.0
16
  * WC tested up to: 5.0.0
10
  * 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.
11
  * Author: Facebook
12
  * Author URI: https://www.facebook.com/
13
+ * Version: 2.3.2
14
  * Text Domain: facebook-for-woocommerce
15
  * WC requires at least: 3.5.0
16
  * WC tested up to: 5.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.3.1\n"
6
  "Report-Msgid-Bugs-To: "
7
  "https://woocommerce.com/my-account/marketplace-ticket-form/\n"
8
- "POT-Creation-Date: 2021-02-23 13:17:44+00:00\n"
9
  "MIME-Version: 1.0\n"
10
  "Content-Type: text/plain; charset=utf-8\n"
11
  "Content-Transfer-Encoding: 8bit\n"
@@ -974,17 +974,17 @@ msgstr ""
974
  msgid "Uninstall unsuccessful. Please try again."
975
  msgstr ""
976
 
977
- #: includes/Handlers/Connection.php:409
978
  #. translators: Placeholders: %s - API error message
979
  msgid "Could not retrieve page access data. %s"
980
  msgstr ""
981
 
982
- #: includes/Handlers/Connection.php:421
983
  #. translators: Placeholders: %s - Facebook page ID
984
  msgid "Page %s not authorized."
985
  msgstr ""
986
 
987
- #: includes/Handlers/Connection.php:1357
988
  msgid "You do not have permission to finish App Store login."
989
  msgstr ""
990
 
@@ -1002,7 +1002,7 @@ msgid ""
1002
  "%s: %s"
1003
  msgstr ""
1004
 
1005
- #: includes/fbgraph.php:104
1006
  msgid "HTTP %s: %s"
1007
  msgstr ""
1008
 
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.3.2\n"
6
  "Report-Msgid-Bugs-To: "
7
  "https://woocommerce.com/my-account/marketplace-ticket-form/\n"
8
+ "POT-Creation-Date: 2021-03-01 23:05:59+00:00\n"
9
  "MIME-Version: 1.0\n"
10
  "Content-Type: text/plain; charset=utf-8\n"
11
  "Content-Transfer-Encoding: 8bit\n"
974
  msgid "Uninstall unsuccessful. Please try again."
975
  msgstr ""
976
 
977
+ #: includes/Handlers/Connection.php:411
978
  #. translators: Placeholders: %s - API error message
979
  msgid "Could not retrieve page access data. %s"
980
  msgstr ""
981
 
982
+ #: includes/Handlers/Connection.php:423
983
  #. translators: Placeholders: %s - Facebook page ID
984
  msgid "Page %s not authorized."
985
  msgstr ""
986
 
987
+ #: includes/Handlers/Connection.php:1359
988
  msgid "You do not have permission to finish App Store login."
989
  msgstr ""
990
 
1002
  "%s: %s"
1003
  msgstr ""
1004
 
1005
+ #: includes/fbgraph.php:105
1006
  msgid "HTTP %s: %s"
1007
  msgstr ""
1008
 
includes/API.php CHANGED
@@ -32,7 +32,7 @@ class API extends Framework\SV_WC_API_Base {
32
 
33
 
34
  /** @var string URI used for the request */
35
- protected $request_uri = 'https://graph.facebook.com/v7.0';
36
 
37
  /** @var string the configured access token */
38
  protected $access_token;
32
 
33
 
34
  /** @var string URI used for the request */
35
+ protected $request_uri = \WC_Facebookcommerce_Graph_API::GRAPH_API_URL . \WC_Facebookcommerce_Graph_API::API_VERSION;
36
 
37
  /** @var string the configured access token */
38
  protected $access_token;
includes/Admin/Settings_Screens/Advertise.php CHANGED
@@ -93,7 +93,7 @@ class Advertise extends Admin\Abstract_Settings_Screen {
93
  appId : '<?php echo esc_js( $connection_handler->get_client_id() ); ?>',
94
  autoLogAppEvents : true,
95
  xfbml : true,
96
- version : 'v8.0',
97
  } );
98
  };
99
  </script>
93
  appId : '<?php echo esc_js( $connection_handler->get_client_id() ); ?>',
94
  autoLogAppEvents : true,
95
  xfbml : true,
96
+ version : 'v8.0', // Note: This expires on November 1 2022
97
  } );
98
  };
99
  </script>
includes/Handlers/Connection.php CHANGED
@@ -395,7 +395,9 @@ class Connection {
395
 
396
  facebook_for_woocommerce()->log( 'Retrieving page access token' );
397
 
398
- $response = wp_remote_get( 'https://graph.facebook.com/v7.0/me/accounts?access_token=' . $this->get_access_token() );
 
 
399
 
400
  $body = wp_remote_retrieve_body( $response );
401
  $body = json_decode( $body, true );
395
 
396
  facebook_for_woocommerce()->log( 'Retrieving page access token' );
397
 
398
+ $api_url = \WC_Facebookcommerce_Graph_API::GRAPH_API_URL . \WC_Facebookcommerce_Graph_API::API_VERSION;
399
+
400
+ $response = wp_remote_get( $api_url . '/me/accounts?access_token=' . $this->get_access_token() );
401
 
402
  $body = wp_remote_retrieve_body( $response );
403
  $body = json_decode( $body, true );
includes/ProductSets/Sync.php CHANGED
@@ -387,6 +387,7 @@ class Sync {
387
  $data = array(
388
  'name' => $term->name,
389
  'filter' => wp_json_encode( array( 'or' => $products ) ),
 
390
  );
391
 
392
  do_action( 'fb_wc_product_set_sync', $data, $product_set_id );
387
  $data = array(
388
  'name' => $term->name,
389
  'filter' => wp_json_encode( array( 'or' => $products ) ),
390
+ 'metadata' => wp_json_encode( array( 'description' => $term->description ) ),
391
  );
392
 
393
  do_action( 'fb_wc_product_set_sync', $data, $product_set_id );
includes/fbgraph.php CHANGED
@@ -24,7 +24,8 @@ if ( ! class_exists( 'WC_Facebookcommerce_Graph_API' ) ) :
24
  * FB Graph API helper functions
25
  */
26
  class WC_Facebookcommerce_Graph_API {
27
- const GRAPH_API_URL = 'https://graph.facebook.com/v2.9/';
 
28
  const CURL_TIMEOUT = 500;
29
 
30
  /**
@@ -396,13 +397,13 @@ if ( ! class_exists( 'WC_Facebookcommerce_Graph_API' ) ) :
396
 
397
  // POST https://graph.facebook.com/vX.X/{product-catalog-id}/product_sets
398
  public function create_product_set_item( $product_catalog_id, $data ) {
399
- $url = $this->build_url( $product_catalog_id, '/product_sets', '8.0' );
400
  return self::_post( $url, $data );
401
  }
402
 
403
  // POST https://graph.facebook.com/vX.X/{product-set-id}
404
  public function update_product_set_item( $product_set_id, $data ) {
405
- $url = $this->build_url( $product_set_id, '', '8.0' );
406
  return self::_post( $url, $data );
407
  }
408
 
@@ -410,7 +411,7 @@ if ( ! class_exists( 'WC_Facebookcommerce_Graph_API' ) ) :
410
 
411
  $params = ( true === apply_filters( 'wc_facebook_commerce_allow_live_product_set_deletion', true, $product_set_id ) ) ? '?allow_live_product_set_deletion=true' : '';
412
 
413
- $url = $this->build_url( $product_set_id, $params, '9.0' );
414
 
415
  return self::_delete( $url );
416
  }
@@ -593,7 +594,9 @@ if ( ! class_exists( 'WC_Facebookcommerce_Graph_API' ) ) :
593
  private function build_url( $field_id, $param = '', $api_version = '' ) {
594
  $api_url = self::GRAPH_API_URL;
595
  if ( ! empty( $api_version ) ) {
596
- $api_url = str_replace( '2.9', str_replace( 'v', '', trim( $api_version ) ), $api_url );
 
 
597
  }
598
  return $api_url . (string) $field_id . $param;
599
  }
24
  * FB Graph API helper functions
25
  */
26
  class WC_Facebookcommerce_Graph_API {
27
+ const GRAPH_API_URL = 'https://graph.facebook.com/';
28
+ const API_VERSION = 'v9.0';
29
  const CURL_TIMEOUT = 500;
30
 
31
  /**
397
 
398
  // POST https://graph.facebook.com/vX.X/{product-catalog-id}/product_sets
399
  public function create_product_set_item( $product_catalog_id, $data ) {
400
+ $url = $this->build_url( $product_catalog_id, '/product_sets' );
401
  return self::_post( $url, $data );
402
  }
403
 
404
  // POST https://graph.facebook.com/vX.X/{product-set-id}
405
  public function update_product_set_item( $product_set_id, $data ) {
406
+ $url = $this->build_url( $product_set_id, '' );
407
  return self::_post( $url, $data );
408
  }
409
 
411
 
412
  $params = ( true === apply_filters( 'wc_facebook_commerce_allow_live_product_set_deletion', true, $product_set_id ) ) ? '?allow_live_product_set_deletion=true' : '';
413
 
414
+ $url = $this->build_url( $product_set_id, $params );
415
 
416
  return self::_delete( $url );
417
  }
594
  private function build_url( $field_id, $param = '', $api_version = '' ) {
595
  $api_url = self::GRAPH_API_URL;
596
  if ( ! empty( $api_version ) ) {
597
+ $api_url = $api_url . $api_version . '/';
598
+ } else {
599
+ $api_url = $api_url . self::API_VERSION . '/';
600
  }
601
  return $api_url . (string) $field_id . $param;
602
  }
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.6
6
- Stable tag: 2.3.1
7
  Requires PHP: 5.6 or greater
8
  MySQL: 5.6 or greater
9
  License: GPLv2 or later
@@ -39,6 +39,9 @@ When opening a bug on GitHub, please give us as many details as possible.
39
 
40
  == Changelog ==
41
 
 
 
 
42
  = 2021.02.23 - version 2.3.1 =
43
  * Fix - Fix errors when product set is empty
44
  * Fix - Ensure that events have an action_source
3
  Tags: facebook, shop, catalog, advertise, pixel, product
4
  Requires at least: 4.4
5
  Tested up to: 5.6
6
+ Stable tag: 2.3.2
7
  Requires PHP: 5.6 or greater
8
  MySQL: 5.6 or greater
9
  License: GPLv2 or later
39
 
40
  == Changelog ==
41
 
42
+ = 2021.03.02 - version 2.3.2 =
43
+ * Tweak - Bump Facebook Marketing API version to 9.0
44
+
45
  = 2021.02.23 - version 2.3.1 =
46
  * Fix - Fix errors when product set is empty
47
  * Fix - Ensure that events have an action_source