-
Notifications
You must be signed in to change notification settings - Fork 145
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
Check if this is WooCommerce product before processing #2680
Conversation
@@ -315,7 +315,7 @@ public function __construct( WC_Facebookcommerce $facebook_for_woocommerce ) { | |||
|
|||
add_action( 'add_meta_boxes', 'WooCommerce\Facebook\Admin\Product_Sync_Meta_Box::register', 10, 1 ); | |||
|
|||
add_action( 'add_meta_boxes', [ $this, 'display_batch_api_completed' ], 10, 2 ); | |||
add_action( 'add_meta_boxes_product', [ $this, 'display_batch_api_completed' ], 10, 2 ); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should use add_meta_boxes_{$post_type}
hook instead of add_meta_boxes
. The order page triggers add_meta_boxes
with screen_id
and order
instead of $post_type
and $post
.
$fb_product_item_id = null; | ||
$should_sync = true; | ||
$no_sync_reason = ''; | ||
public function display_batch_api_completed( $post ) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
add_meta_boxes_{$post_type}
sends only the $post
object:
https://github.com/WordPress/wordpress-develop/blob/87dfd5514b52aef456b7232b1959873e69e651da/src/wp-admin/includes/meta-boxes.php#L1731-L1731
There are two errors: When accessing from the edit page:
When accessing from the edit order:
I've pushed additional commit to fix the error triggered from edit order as well. |
Thanks folks, couldn't have seen this one coming. |
Changes proposed in this Pull Request:
Closes #2672 .
Check if we are dealing with WooCommerce product before processing.
phpcs
checks? Please removephpcs:ignore
comments in changed files and fix any issues, or delete if not practical.Detailed test instructions:
I can't reproduce the 2672 so really hard to tell.
Changelog entry