// Fire AddPaymentInfo when WooCommerce renders the checkout form (not thank-you)
add_action('woocommerce_after_checkout_form', function () {
if (function_exists('is_checkout') && is_checkout() && !is_order_received_page()) {
?>
document.addEventListener('DOMContentLoaded', function () {
if (window.fbq) { fbq('track', 'AddPaymentInfo'); }
});