Skip to content
Open
Changes from all commits
Commits
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
9 changes: 7 additions & 2 deletions includes/class-mailchimp-woocommerce-service.php
Original file line number Diff line number Diff line change
Expand Up @@ -367,8 +367,13 @@ public function handleAPICouponTrashed($object, $response, $request)
* @param WP_Post $post_before The post object as it exists after the update
* @return void
*/
public function handleProductUpdated( int $post_ID, WP_Post $post_after, WP_Post $post_before )
public function handleProductUpdated( int $post_ID, ?WP_Post $post_after, ?WP_Post $post_before )
{
// Ensure $post_after is a valid WP_Post
if ( ! $post_after instanceof WP_Post ) {
return;
}

if ('product' !== $post_after->post_type) {
return;
}
Expand All @@ -378,7 +383,7 @@ public function handleProductUpdated( int $post_ID, WP_Post $post_after, WP_Post
return;
}

/// old filter array('trash', 'auto-draft', 'draft', 'pending', 'private')
// 'draft', 'pending'
if (in_array($post_after->post_status, array('trash', 'auto-draft'))) {
mailchimp_log('product.update.blocked', "product {$post_ID} was blocked because status is {$post_after->post_status}");
return;
Expand Down