Additional custom field value passing issue on WooCommerce Checkout block

Currently, I can display custom fields on the checkout page but I’m struggling to pass the values to the POST request so I can process them further. I have all name, id attributes on my inputs but still no luck.

On checkout.js I’ve include custom field with below code.

// Import necessary modules from WordPress
const { createElement, Fragment } = wp.element;
const { __ } = wp.i18n;

// Get settings from WooCommerce
const paythensettings = window.paythen_custom_gateway_data;
const paythenlabel = wp.htmlEntities.decodeEntities(paythensettings.title) || __('Paythen Custom Gateway', 'paythen_custom_gateway');

// Function to create and return the content as a React element
const createPaythenContent = () => {
    // Generate the description content
    const description = wp.htmlEntities.decodeEntities(paythensettings.description || '');

    // Create description element
    const descriptionElement = createElement('div', { className: 'paythen-description' }, description);

    // Create Installment Field if applicable
    let installmentField = null;
    if (paythensettings.numberInstallments === 'yes') {
        if (paythensettings.minInstallment && paythensettings.maxInstallment) {
            // Create dropdown if both minimum and maximum installments are defined
            const options = [];
            for (let i = paythensettings.minInstallment; i <= paythensettings.maxInstallment; i++) {
                options.push(createElement('option', { value: i, key: i, selected: i === paythensettings.minInstallment }, i));
            }
            installmentField = createElement('div', { className: 'installment-options' },
                createElement('label', { htmlFor: 'customer_instalment' }, __('Choose Installments', 'woocommerce')),
                createElement('select', { id: 'customer_instalment', name: 'customer_instalment' }, options)
            );
        } else {
            // Create number input field if either or both minimum and maximum installments are not defined
            installmentField = createElement('div', { className: 'installment-options' },
                createElement('label', { htmlFor: 'customer_instalment' }, __('Choose Installments', 'woocommerce')),
                createElement('input', { type: 'number', id: 'customer_instalment', name: 'customer_instalment' })
            );
        }
    }

    // Create Separate Payment Options if applicable
    const separatePaymentOptions = paythensettings.separatePayment === 'yes' ? createElement('div', { className: 'separate-payment-options' },
        createElement('label', { className: 'separate-label' }, __('Choose your payment option', 'woocommerce')),
        ...paythensettings.paymentOptions.map((option, index) =>
            createElement('div', { key: option.url },
                createElement('input', { type: 'radio', name: 'separate_payment', value: option.url, defaultChecked: index === 0 }),
                createElement('label', null, option.title)
            )
        )
    ) : null;

    // Combine all parts into a single content element
    return createElement(Fragment, null, descriptionElement, installmentField, separatePaymentOptions);
};

// Register the payment method
const Paythen_Block_Gateway = {
    name: 'paythen',
    label: paythenlabel,
    content: createElement(createPaythenContent),
    edit: createElement(createPaythenContent),
    canMakePayment: () => true,
    ariaLabel: paythenlabel,
    supports: {
        features: paythensettings.supports,
    },
};

// Ensure the registry is ready and then register the payment method
if (window.wc && window.wc.wcBlocksRegistry) {
    window.wc.wcBlocksRegistry.registerPaymentMethod(Paythen_Block_Gateway);
} else {
    console.error('WooCommerce Blocks registry is not available.');
}

On other file I’ve called 2 field

// Add Installment Field
        if ($numberInstallments == 'yes') {
            $description .= '<div class="installment-options">';
            $description .= '<label for="customer_instalment">' . __('Choose Installments', 'woocommerce') . '</label>';
            
            // Check if both minimumInstallment and maximumInstallment are defined
            if (isset($minimumInstallment) && isset($maximumInstallment)) {
                $description .= '<select id="customer_instalment" name="customer_instalment">';
                for ($i = $minimumInstallment; $i <= $maximumInstallment; $i++) {
                    $selected = ($i == $minimumInstallment) ? 'selected' : '';
                    $description .= '<option value="' . esc_attr($i) . '" ' . $selected . '>' . esc_html($i) . '</option>';
                }
                $description .= '</select>';
            } else {
                $description .= '<input type="number" id="customer_instalment" name="customer_instalment">';
            }

            $description .= '</div>';
        }


        // Add Separate Payment Options
        if ($numberInstallments == 'no' && $separatePayment == 'yes') {
            if (!empty($payment_title_one) || !empty($payment_title_two) || !empty($payment_title_three)) {
                $payment_options = array();

                // Create an array of payment options and their URLs, excluding options with empty values
                if (!empty($payment_title_one) && !empty($payment_url_one)) {
                    $payment_options[$payment_title_one] = $payment_url_one;
                }
                if (!empty($payment_title_two) && !empty($payment_url_two)) {
                    $payment_options[$payment_title_two] = $payment_url_two;
                }
                if (!empty($payment_title_three) && !empty($payment_url_three)) {
                    $payment_options[$payment_title_three] = $payment_url_three;
                }

                // Generate radio buttons for payment options and append to $description
                $description .= '<div class="separate-payment-options">';
                $description .= '<label class="separate-label">' . __('Choose a payment plan option:', 'woocommerce') . '</label>';
                $count_id = 0;
                foreach ($payment_options as $title => $url) {
                    $description .= '<input type="radio" name="separate_payment" id="separate_payment_'.$count_id.'" value="' . esc_attr($url) . '">';
                    $description .= '<label for="separate_payment_'.$count_id.'">' . esc_html($title) . '</label><br>';
                    $count_id++;
                }
                $description .= '</div>';
            }
        }

While grab value from front-end and tries to save on meta_data not able to get input value inside $_POST

add_action('woocommerce_checkout_create_order', 'save_paythen_option_order_meta', 20, 2);

function save_paythen_option_order_meta($order, $data) {
    if (isset($_POST['customer_instalment']) && !empty($_POST['customer_instalment'])) {
        $order->update_meta_data('_customer_instalment', sanitize_text_field($_POST['customer_instalment']));
    }
    
    if (isset($_POST['separate_payment']) && !empty($_POST['separate_payment'])) {
        $order->update_meta_data('_separate_payment', sanitize_text_field($_POST['separate_payment']));
    }

    $order->save();
}

Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa Dịch vụ tổ chức sự kiện 5 sao Thông tin về chúng tôi Dịch vụ sinh nhật bé trai Dịch vụ sinh nhật bé gái Sự kiện trọn gói Các tiết mục giải trí Dịch vụ bổ trợ Tiệc cưới sang trọng Dịch vụ khai trương Tư vấn tổ chức sự kiện Hình ảnh sự kiện Cập nhật tin tức Liên hệ ngay Thuê chú hề chuyên nghiệp Tiệc tất niên cho công ty Trang trí tiệc cuối năm Tiệc tất niên độc đáo Sinh nhật bé Hải Đăng Sinh nhật đáng yêu bé Khánh Vân Sinh nhật sang trọng Bích Ngân Tiệc sinh nhật bé Thanh Trang Dịch vụ ông già Noel Xiếc thú vui nhộn Biểu diễn xiếc quay đĩa Dịch vụ tổ chức tiệc uy tín Khám phá dịch vụ của chúng tôi Tiệc sinh nhật cho bé trai Trang trí tiệc cho bé gái Gói sự kiện chuyên nghiệp Chương trình giải trí hấp dẫn Dịch vụ hỗ trợ sự kiện Trang trí tiệc cưới đẹp Khởi đầu thành công với khai trương Chuyên gia tư vấn sự kiện Xem ảnh các sự kiện đẹp Tin mới về sự kiện Kết nối với đội ngũ chuyên gia Chú hề vui nhộn cho tiệc sinh nhật Ý tưởng tiệc cuối năm Tất niên độc đáo Trang trí tiệc hiện đại Tổ chức sinh nhật cho Hải Đăng Sinh nhật độc quyền Khánh Vân Phong cách tiệc Bích Ngân Trang trí tiệc bé Thanh Trang Thuê dịch vụ ông già Noel chuyên nghiệp Xem xiếc khỉ đặc sắc Xiếc quay đĩa thú vị
Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa
Thiết kế website Thiết kế website Thiết kế website Cách kháng tài khoản quảng cáo Mua bán Fanpage Facebook Dịch vụ SEO Tổ chức sinh nhật