Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

v2.6.29 and v2.6.30 #2369

Merged
merged 57 commits into from
Nov 15, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
57 commits
Select commit Hold shift + click to select a range
3803e90
Adds local dev configurations to gitignore
ibndawood Oct 17, 2022
af5a2d7
Rename all mentions of FB Product Set to Facebook Product Set
ibndawood Oct 17, 2022
37bb44f
Check for connection and add Facebook Product Sets to Marketing Menu
ibndawood Oct 17, 2022
16cfaf0
Adds IDE files to gitignore
ibndawood Oct 20, 2022
e6c0559
Adds a setup task
ibndawood Oct 21, 2022
a9b3472
Fix phplint issues
ibndawood Oct 21, 2022
972da16
Sets the correct parent menu and submenu for Facebook Product Sets ta…
ibndawood Oct 21, 2022
716cd75
Adds a method to get the last upgrade from version
ibndawood Oct 21, 2022
fe539fa
Adds SettingsMoved note class
ibndawood Oct 21, 2022
63b62fd
Rename lowercase FB product set to Facebook Product Set
ibndawood Oct 21, 2022
acc0011
Merge pull request #2336 from woocommerce/add/2328-rename-fb-product-…
ibndawood Oct 21, 2022
a97a6a5
Refactors settings moved not add logic
ibndawood Oct 26, 2022
de3fa1b
Fix php lint issues
ibndawood Oct 26, 2022
5c37962
Change task time from 5 minutes to 20 mins (#2298)
ibndawood Oct 27, 2022
ac0c356
Update includes/Admin/Notes/SettingsMoved.php
ibndawood Oct 27, 2022
653bc21
Merge pull request #2340 from woocommerce/add/2299-facebook-menu-noti…
ibndawood Oct 27, 2022
39554f0
Run the setup task to admin init from init
ibndawood Oct 27, 2022
d09f2f2
Merge branch 'feature/hosted-woo-updates' into add/2298-facebook-read…
ibndawood Oct 27, 2022
0585693
Removed leading namespace separator from facebook_for_woocommerce()
ibndawood Oct 27, 2022
44000f3
Merge pull request #2335 from woocommerce/add/2298-facebook-ready-task
ibndawood Oct 27, 2022
2b4b58f
Sets the screen ID according to the orders data store
ibndawood Oct 28, 2022
62c3033
Sets the correct orders and order page according to data store used
ibndawood Oct 28, 2022
13989e7
Sets HPOS compatibility to true
ibndawood Oct 28, 2022
44f995d
Rename to to resolve ambiguity
ibndawood Oct 28, 2022
81a33da
Rename variable screen_order to order_screen_id to resolve ambiguity
ibndawood Oct 28, 2022
4909c4c
Merge branch 'add/2260-hpos-compatibility' of github.com:woocommerce/…
ibndawood Oct 28, 2022
6533caf
Change setup task hook from admin_init to init
ibndawood Oct 31, 2022
80f4fa9
Merge pull request #2345 from woocommerce/add/2260-hpos-compatibility
ibndawood Oct 31, 2022
f1d906e
Replaces custom_orders_table_usage_is_enabled method from Internal cl…
ibndawood Oct 31, 2022
aaf6043
Fix duplicate InitiateCheckout when using checkout block.
rawdreeg Nov 1, 2022
40b4466
Removes unused class TaskLists from the namespace import
ibndawood Nov 1, 2022
f30206d
Update includes/Admin.php
ibndawood Nov 2, 2022
3308a36
Merge pull request #2342 from woocommerce/feature/hosted-woo-updates
ibndawood Nov 2, 2022
168a89c
Ensure the posted value is unslashed before saving in the post_meta t…
rawdreeg Nov 4, 2022
4401263
Merge pull request #2354 from woocommerce/fix/2353-fix-advanced-produ…
rawdreeg Nov 4, 2022
ac30019
Sync product set when the term name changes.
rawdreeg Nov 4, 2022
2c4b71d
Update doc bloc description
rawdreeg Nov 4, 2022
4ebc7df
Redirect the users to advertise tab of the plugin when FBE is installed
rahulmaddineni Nov 4, 2022
32e3a18
Merge pull request #2350 from woocommerce/fix/2347-replace-internal-n…
ibndawood Nov 7, 2022
0bd3950
Redirect to connection tab if connection fails.
rawdreeg Nov 7, 2022
f487f64
Add exit statements after redirect.
rawdreeg Nov 7, 2022
fa334cf
Merge pull request #2356 from woocommerce/change/redirect-fbe-to-adve…
rawdreeg Nov 7, 2022
cea02c7
Adds backward compatibility for Notes and TaskLists classes (#2357)
ibndawood Nov 7, 2022
c1cee2d
Bumps minimum WC to 5.3 (#2357)
ibndawood Nov 7, 2022
48fbb1e
Merge pull request #2358 from woocommerce/fix/2357-backward-compatibi…
ibndawood Nov 7, 2022
a2cab05
Use ::class for classname resolution (#2357)
ibndawood Nov 7, 2022
728dba8
Merge pull request #2359 from woocommerce/fix/2357-classname-resolution
ibndawood Nov 7, 2022
0018668
Merge pull request #2349 from woocommerce/fix/duplicate-InitiateCheck…
rawdreeg Nov 7, 2022
180b830
Product version bump update
ibndawood Nov 8, 2022
692d891
Changelog update
ibndawood Nov 8, 2022
d617ba8
Merge pull request #2355 from woocommerce/fix/2344-product_sets_title…
rawdreeg Nov 8, 2022
47b54c3
Adds backward compatibility for WC 6.1, 6.2, 6.3. (#2362)
ibndawood Nov 8, 2022
f73c465
Return parent task id string instead of undefined property. (#2362)
ibndawood Nov 9, 2022
4222e2c
Merge pull request #2363 from woocommerce/fix/implement-abstract-method
ibndawood Nov 9, 2022
5a761eb
Product version bump update
ibndawood Nov 9, 2022
26ee0f8
Changelog update
ibndawood Nov 9, 2022
99d83b0
Merge pull request #2365 from woocommerce/release/2.6.30
rawdreeg Nov 9, 2022
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -34,4 +34,8 @@ codeception.yml

# local dev configurations
.wp-env.json
php.ini
php.ini
wp-config.php

# IDE files
.vscode/*
19 changes: 19 additions & 0 deletions changelog.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,24 @@
*** Facebook for WooCommerce Changelog ***

= 2.6.30 - 2022-11-09 =
* Fix - Add backward compatibility for WC 6.1, 6.2, and 6.3 versions.
* Fix - Sync product set when the term name changes.

= 2.6.29 - 2022-11-08 =
* Add - Facebook Product Set under the Marketing menu.
* Add - HPOS Compatibility.
* Add - Inbox note about Facebook menu moved under the Marketing menu.
* Add - Set up Facebook task to the WooCommerce admin tasks.
* Dev - Replaced methods from classes in the `Internal` namespace.
* Fix - Ensure the enhanced product enhance catalog attributes value is unslashed before saving in the post_meta table.
* Fix - Hosted Woo Updates.
* Fix - Release/2.6.28.
* Fix - duplicate InitiateCheckout when using checkout block.
* Tweak - WC 7.1 compatibility.
* Tweak - WP 6.1 compatibility.
* Update - FB Product Set name changed to Facebook Product Set.
* Update - On successful FBE install users will be redirected to Advertise tab of the plugin.

= 2.6.28 - 2022-10-25 =
* Fix - Ensure bundles are not treated as virtual products on product_sync.
* Fix - Ensure google-product-category-fields-loads.js loads only on the product category screens.
Expand Down
107 changes: 60 additions & 47 deletions class-wc-facebookcommerce.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,10 @@
use SkyVerge\WooCommerce\Facebook\ProductSync\ProductValidator as ProductSyncValidator;
use SkyVerge\WooCommerce\Facebook\Utilities\Heartbeat;
use Automattic\WooCommerce\Admin\Features\Features as WooAdminFeatures;
use Automattic\WooCommerce\Admin\Features\OnboardingTasks\TaskLists;
use Automattic\WooCommerce\Admin\Notes\Note;
use SkyVerge\WooCommerce\Facebook\Admin\Tasks\Setup;
use SkyVerge\WooCommerce\Facebook\Admin\Notes\SettingsMoved;

if ( ! class_exists( 'WC_Facebookcommerce' ) ) :

Expand Down Expand Up @@ -133,6 +137,9 @@ public function init() {
add_filter( 'fb_product_set_row_actions', array( $this, 'product_set_links' ) );
add_filter( 'manage_edit-fb_product_set_columns', array( $this, 'manage_fb_product_set_columns' ) );

// Hook the setup task. The hook admin_init is not triggered when the WC fetches the tasks using the endpoint: wp-json/wc-admin/onboarding/tasks and hence hooking into init.
add_action( 'init', array( $this, 'add_setup_task' ), 20 );

// Product Set breadcrumb filters
add_filter( 'woocommerce_navigation_is_connected_page', array( $this, 'is_current_page_conected_filter' ), 99, 2 );
add_filter( 'woocommerce_navigation_get_breadcrumbs', array( $this, 'wc_page_breadcrumbs_filter' ), 99 );
Expand Down Expand Up @@ -250,6 +257,21 @@ protected function get_deprecated_hooks() {
);
}

/**
* Adds the setup task to the Tasklists.
*
* @since 2.6.29
*/
public function add_setup_task() {
if ( class_exists( TaskLists::class ) ) { // This is added for backward compatibility.
TaskLists::add_task(
'extended',
new Setup(
TaskLists::get_list( 'extended' )
)
);
}
}

/**
* Adds the plugin admin notices.
Expand Down Expand Up @@ -303,30 +325,6 @@ public function add_admin_notices() {
)
);
}

// otherwise, a general getting started message
} elseif ( ! $this->is_plugin_settings() ) {

$message = sprintf(
/* translators: Placeholders %1$s - opening strong HTML tag, %2$s - closing strong HTML tag, %3$s - opening link HTML tag, %4$s - closing link HTML tag */
esc_html__(
'%1$sFacebook for WooCommerce is almost ready.%2$s To complete your configuration, %3$scomplete the setup steps%4$s.',
'facebook-for-woocommerce'
),
'<strong>',
'</strong>',
'<a href="' . esc_url( facebook_for_woocommerce()->get_settings_url() ) . '">',
'</a>'
);

$this->get_admin_notice_handler()->add_admin_notice(
$message,
self::PLUGIN_ID . '_get_started',
array(
'dismissible' => true,
'notice_class' => 'notice-info',
)
);
}

// notices for those connected to FBE 2
Expand Down Expand Up @@ -389,26 +387,27 @@ public function add_admin_notices() {
&& \Automattic\WooCommerce\Admin\Loader::is_feature_enabled( 'marketing' );
}

if ( $is_marketing_enabled ) {

$this->get_admin_notice_handler()->add_admin_notice(
sprintf(
/* translators: Placeholders: %1$s - opening <a> HTML link tag, %2$s - closing </a> HTML link tag */
esc_html__( 'Heads up! The Facebook menu is now located under the %1$sMarketing%2$s menu.', 'facebook-for-woocommerce' ),
'<a href="' . esc_url( $this->get_settings_url() ) . '">',
'</a>'
),
'settings_moved_to_marketing',
array(
'dismissible' => true,
'always_show_on_settings' => false,
'notice_class' => 'notice-info',
)
);
if ( $is_marketing_enabled && class_exists( Note::class ) ) { // Checking for Note class is for backward compatibility.
SettingsMoved::possibly_add_or_delete_note();
}
}
}

/**
* Get the last event from the plugin lifecycle.
*
* @since 2.6.29
* @return array
*/
public function get_last_event_from_history() {
$last_event = array();
$history_events = $this->lifecycle_handler->get_event_history();

if ( isset( $history_events[0] ) ) {
$last_event = $history_events[0];
}
return $last_event;
}

public function add_wordpress_integration() {
new WP_Facebook_Integration();
Expand Down Expand Up @@ -470,14 +469,14 @@ public function remove_product_fb_product_set_metabox() {
}

/**
* Register FB Product Set Taxonomy
* Register Facebook Product Set Taxonomy
*
* @since 2.3.0
*/
public function register_custom_taxonomy() {

$plural = esc_html__( 'FB Product Sets', 'facebook-for-woocommerce' );
$singular = esc_html__( 'FB Product Set', 'facebook-for-woocommerce' );
$plural = esc_html__( 'Facebook Product Sets', 'facebook-for-woocommerce' );
$singular = esc_html__( 'Facebook Product Set', 'facebook-for-woocommerce' );

$args = array(
'labels' => array(
Expand All @@ -502,14 +501,15 @@ public function register_custom_taxonomy() {
'public' => true,
'show_in_nav_menus' => false,
'show_tagcloud' => false,
'show_in_menu' => false,
);

register_taxonomy( 'fb_product_set', array( 'product' ), $args );
}


/**
* Filter FB Product Set Taxonomy table links
* Filter Facebook Product Set Taxonomy table links
*
* @since 2.3.0
*
Expand All @@ -525,7 +525,7 @@ public function product_set_links( $actions ) {


/**
* Remove posts count column from FB Product Set custom taxonomy
* Remove posts count column from Facebook Product Set custom taxonomy
*
* @since 2.3.0
*
Expand All @@ -540,7 +540,7 @@ public function manage_fb_product_set_columns( $columns ) {


/**
* Filter WC Breadcrumbs when the page is FB Product Sets
* Filter WC Breadcrumbs when the page is Facebook Product Sets
*
* @since 2.3.0
*
Expand Down Expand Up @@ -572,7 +572,7 @@ public function wc_page_breadcrumbs_filter( $breadcrumbs ) {


/**
* Return that FB Product Set page is a WC Conected Page
* Return that Facebook Product Set page is a WC Conected Page
*
* @since 2.3.0
*
Expand Down Expand Up @@ -1016,6 +1016,19 @@ public function get_settings_url( $plugin_id = null ) {

return admin_url( 'admin.php?page=wc-facebook' );
}

/**
* Gets the advertise tab page URL.
*
* @since 2.6.29
*
* @return string
*/
public function get_advertise_tab_url() {

return admin_url( 'admin.php?page=wc-facebook&tab=advertise' );
}



/**
Expand Down
2 changes: 1 addition & 1 deletion facebook-commerce-events-tracker.php
Original file line number Diff line number Diff line change
Expand Up @@ -850,7 +850,7 @@ public function inject_add_to_cart_redirect_event() {
*/
public function inject_initiate_checkout_event() {

if ( ! $this->is_pixel_enabled() || $this->pixel->is_last_event( 'InitiateCheckout' ) ) {
if ( ! $this->is_pixel_enabled() || WC()->cart->get_cart_contents_count() === 0 || $this->pixel->is_last_event( 'InitiateCheckout' ) ) {
return;
}

Expand Down
4 changes: 2 additions & 2 deletions facebook-commerce.php
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ class WC_Facebookcommerce_Integration extends WC_Integration {
/** @var string the short product description mode name */
const PRODUCT_DESCRIPTION_MODE_SHORT = 'short';

/** @var string custom taxonomy FB product set ID */
/** @var string custom taxonomy Facebook Product Set ID */
const FB_PRODUCT_SET_ID = 'fb_product_set_id';

/** @var string|null the configured product catalog ID */
Expand Down Expand Up @@ -1667,7 +1667,7 @@ public function create_or_update_product_set_item( $product_set_data, $product_s
)
);

// update product set to set FB Product Set ID
// update product set to set Facebook Product Set ID
if ( $result && empty( $fb_product_set_id ) ) {

// decode and get ID from result body
Expand Down
23 changes: 17 additions & 6 deletions facebook-for-woocommerce.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,18 +11,29 @@
* 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.
* Author: Facebook
* Author URI: https://www.facebook.com/
* Version: 2.6.28
* Version: 2.6.30
* Text Domain: facebook-for-woocommerce
* Tested up to: 6.0
* WC requires at least: 3.5.0
* WC tested up to: 7.0
* Tested up to: 6.1
* WC requires at least: 5.3
* WC tested up to: 7.1
* Requires PHP: 7.0
*
* @package FacebookCommerce
*/

use Automattic\WooCommerce\Utilities\FeaturesUtil;

defined( 'ABSPATH' ) || exit;

// HPOS compatibility declaration.
add_action(
'before_woocommerce_init',
function() {
if ( class_exists( FeaturesUtil::class ) ) {
FeaturesUtil::declare_compatibility( 'custom_order_tables', plugin_basename( __FILE__ ), true );
}
}
);
/**
* The plugin loader class.
*
Expand All @@ -33,7 +44,7 @@ class WC_Facebook_Loader {
/**
* @var string the plugin version. This must be in the main plugin file to be automatically bumped by Woorelease.
*/
const PLUGIN_VERSION = '2.6.28'; // WRCS: DEFINED_VERSION.
const PLUGIN_VERSION = '2.6.30'; // WRCS: DEFINED_VERSION.

// Minimum PHP version required by this plugin.
const MINIMUM_PHP_VERSION = '7.0.0';
Expand All @@ -42,7 +53,7 @@ class WC_Facebook_Loader {
const MINIMUM_WP_VERSION = '4.4';

// Minimum WooCommerce version required by this plugin.
const MINIMUM_WC_VERSION = '3.5.0';
const MINIMUM_WC_VERSION = '5.3';

// SkyVerge plugin framework version used by this plugin.
const FRAMEWORK_VERSION = '5.10.0';
Expand Down
7 changes: 5 additions & 2 deletions includes/Admin.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
namespace SkyVerge\WooCommerce\Facebook;

use SkyVerge\WooCommerce\PluginFramework\v5_10_0\SV_WC_Helper;
use Automattic\WooCommerce\Utilities\OrderUtil;

defined( 'ABSPATH' ) or exit;

Expand Down Expand Up @@ -46,13 +47,15 @@ class Admin {
*/
public function __construct() {

$order_screen_id = class_exists( OrderUtil::class ) ? OrderUtil::get_order_admin_screen() : 'shop_order';

$this->screen_ids = [
'product',
'edit-product',
'woocommerce_page_wc-facebook',
'marketing_page_wc-facebook',
'edit-product_cat',
'shop_order',
$order_screen_id,
];

// enqueue admin scripts
Expand Down Expand Up @@ -205,7 +208,7 @@ public function enqueue_scripts() {
array(

'excluded_category_ids' => facebook_for_woocommerce()->get_integration()->get_excluded_product_category_ids(),
'excluded_category_warning_message' => __( 'You have selected one or more categories currently excluded from the Facebook sync. Products belonging to the excluded categories will not be added to your FB product set.', 'facebook-for-woocommerce' ),
'excluded_category_warning_message' => __( 'You have selected one or more categories currently excluded from the Facebook sync. Products belonging to the excluded categories will not be added to your Facebook Product Set.', 'facebook-for-woocommerce' ),
)
);
}
Expand Down
Loading