Sous-total : CHF 77.00
/** * Colonne « Suivi » dans la liste des commandes. * * Montre, pour chaque commande, ce que le visiteur a répondu à la bannière de * cookies et où la vente a réellement été transmise. Le relevé du consentement * n'existe que depuis le passage de Pixel Manager en version Pro, le 18.09.2026 ; * les commandes antérieures affichent un tiret. */ function bw_get_order_tracking_state( $order ) { $order_id = $order instanceof WC_Order ? $order->get_id() : (int) $order; if ( ! $order_id ) { return '—'; } $snapshot = get_post_meta( $order_id, '_pmw_consent_snapshot', true ); if ( ! is_array( $snapshot ) ) { return '—'; } if ( empty( $snapshot['visitor_has_chosen'] ) ) { $consent = __( 'Sans réponse', 'your-textdomain' ); } elseif ( ! empty( $snapshot['statistics'] ) || ! empty( $snapshot['marketing'] ) ) { $consent = __( 'Accepté', 'your-textdomain' ); } else { $consent = __( 'Refusé', 'your-textdomain' ); } $sent = array(); if ( get_post_meta( $order_id, 'wpm_google_analytics_4_mp_purchase_hit', true ) ) { $sent[] = 'GA4'; } if ( get_post_meta( $order_id, 'wpm_facebook_capi_purchase_hit', true ) ) { $sent[] = 'Meta'; } return $consent . ' · ' . ( $sent ? implode( ' + ', $sent ) : __( 'non transmise', 'your-textdomain' ) ); } // --- Colonnes (écran classique) --- add_filter( 'manage_edit-shop_order_columns', function( $columns ) { if ( ! isset( $columns['bw_order_tracking'] ) ) { $columns['bw_order_tracking'] = __( 'Suivi', 'your-textdomain' ); } return $columns; }, 21 ); add_action( 'manage_shop_order_posts_custom_column', function( $column, $post_id ) { if ( 'bw_order_tracking' === $column ) { echo esc_html( bw_get_order_tracking_state( $post_id ) ); } }, 21, 2 ); // --- Colonnes (HPOS) --- add_filter( 'woocommerce_shop_order_list_table_columns', function( $columns ) { if ( ! isset( $columns['bw_order_tracking'] ) ) { $columns['bw_order_tracking'] = __( 'Suivi', 'your-textdomain' ); } return $columns; }, 21 ); add_action( 'woocommerce_shop_order_list_table_custom_column', function( $column, $order ) { if ( 'bw_order_tracking' === $column && $order instanceof WC_Order ) { echo esc_html( bw_get_order_tracking_state( $order ) ); } }, 21, 2 );