Skip to content

Commit

Permalink
Adds a tooltip to Facebook sync status (#2625)
Browse files Browse the repository at this point in the history
  • Loading branch information
ibndawood authored Sep 4, 2023
2 parents fc596dd + af52589 commit 24c0613
Showing 1 changed file with 17 additions and 2 deletions.
19 changes: 17 additions & 2 deletions includes/Admin.php
Original file line number Diff line number Diff line change
Expand Up @@ -458,15 +458,30 @@ public function add_product_list_table_columns_content( $column ) {
return;
}

$product = wc_get_product( $post );
if ( $product && Products::product_should_be_synced( $product ) ) {
$product = wc_get_product( $post );
$should_sync = false;
$no_sync_reason = '';

if ( $product instanceof \WC_Product ) {
try {
facebook_for_woocommerce()->get_product_sync_validator( $product )->validate();
$should_sync = true;
} catch ( \Exception $e ) {
$no_sync_reason = $e->getMessage();
}
}

if ( $should_sync ) {
if ( Products::is_product_visible( $product ) ) {
esc_html_e( 'Sync and show', 'facebook-for-woocommerce' );
} else {
esc_html_e( 'Sync and hide', 'facebook-for-woocommerce' );
}
} else {
esc_html_e( 'Do not sync', 'facebook-for-woocommerce' );
if ( ! empty( $no_sync_reason ) ) {
echo wc_help_tip( $no_sync_reason );
}
}
}

Expand Down

0 comments on commit 24c0613

Please sign in to comment.