WooCommerce Custom Payment Gateway Plugin Not Displaying in Checkout

I have created a custom payment gateway plugin for WooCommerce. The plugin activates without any errors, and debugging logs show that the gateway class is registered and initialized. However, the payment method does not appear in the WooCommerce checkout page, and the message “There are no payment methods available” is displayed.

Here’s the complete code for the plugin:

<?php
/**
 * Plugin name: Noob Payment for Woocommerce
 * Plugin URI: http://www.insafinhaam.com/custom-woocommerce-payment-gateway-plugin
 * Author: Insaf Inhaam
 * Author URI: https://insafinhaam.com/
 * Description: This Plugin allows for local content payment system
 * Version: 1.0.0
 * License: 0.1.0
 * Text Domain: noob-pay-woo
 */

if (!in_array('woocommerce/woocommerce.php', apply_filters('active_plugins', get_option('active_plugins'))))
    return;

add_action('plugins_loaded', 'noob_payment_init', 11);

function noob_payment_init()
{
    if (class_exists('WC_Payment_Gateway')) {
        class WC_Noob_pay_Gateway extends WC_Payment_Gateway
        {
            public function __construct()
            {
                $this->id = 'noob_payment';
                $this->icon = apply_filters('woocommerce_noob_icon', plugins_url('/assets/icon.png', __FILE__));
                $this->has_fields = false;
                $this->method_title = __('Noob Payment', 'noob-pay-woo');
                $this->method_description = __('Noob local content payment systems.', 'noob-pay-woo');

                $this->title = $this->get_option('title');
                $this->description = $this->get_option('description');
                $this->instructions = $this->get_option('instructions', $this->description);

                $this->init_form_fields();
                $this->init_settings();

                add_action('woocommerce_update_options_payment_gateways_' . $this->id, array($this, 'process_admin_options'));
                // add_action( 'woocommerce_thank_you_' . $this->id, array( $this, 'thank_you_page' ) );
            }

            public function init_form_fields()
            {
                $this->form_fields = apply_filters('woo_noob_pay_fields', array(
                    'enabled' => array(
                        'title' => __('Enable/Disable', 'noob-pay-woo'),
                        'type' => 'checkbox',
                        'label' => __('Enable or Disable Noob Payments', 'noob-pay-woo'),
                        'default' => 'no'
                    ),
                    'title' => array(
                        'title' => __('Noob Payments Gateway', 'noob-pay-woo'),
                        'type' => 'text',
                        'default' => __('Noob Payments Gateway', 'noob-pay-woo'),
                        'desc_tip' => true,
                        'description' => __('Add a new title for the Noob Payments Gateway that customers will see when they are in the checkout page.', 'noob-pay-woo')
                    ),
                    'description' => array(
                        'title' => __('Noob Payments Gateway Description', 'noob-pay-woo'),
                        'type' => 'textarea',
                        'default' => __('Please remit your payment to the shop to allow for the delivery to be made', 'noob-pay-woo'),
                        'desc_tip' => true,
                        'description' => __('Add a new title for the Noob Payments Gateway that customers will see when they are in the checkout page.', 'noob-pay-woo')
                    ),
                    'instructions' => array(
                        'title' => __('Instructions', 'noob-pay-woo'),
                        'type' => 'textarea',
                        'default' => __('Default instructions', 'noob-pay-woo'),
                        'desc_tip' => true,
                        'description' => __('Instructions that will be added to the thank you page and odrer email', 'noob-pay-woo')
                    ),
                    // 'enable_for_virtual' => array(
                    //     'title'   => __( 'Accept for virtual orders', 'woocommerce' ),
                    //     'label'   => __( 'Accept COD if the order is virtual', 'woocommerce' ),
                    //     'type'    => 'checkbox',
                    //     'default' => 'yes',
                    // ),
                )
                );
            }

            public function process_payments($order_id)
            {

                $order = wc_get_order($order_id);

                $order->update_status('on-hold', __('Awaiting Noob Payment', 'noob-pay-woo'));

                // if ( $order->get_total() > 0 ) {
                // Mark as on-hold (we're awaiting the cheque).
                // } else {
                // $order->payment_complete();
                // }

                // $this->clear_payment_with_api();

                $order->reduce_order_stock();

                WC()->cart->empty_cart();

                return array(
                    'result' => 'success',
                    'redirect' => $this->get_return_url($order),
                );
            }

            // public function clear_payment_with_api() {

            // }

            public function thank_you_page()
            {
                if ($this->instructions) {
                    echo wpautop($this->instructions);
                }
            }
        }
    }
}

add_filter('woocommerce_payment_gateways', 'add_to_woo_noob_payment_gateway');

function add_to_woo_noob_payment_gateway($gateways)
{
    $gateways[] = 'WC_Noob_pay_Gateway';
    return $gateways;
}

What I have tried:

  • Confirmed that WooCommerce is active.

  • Verified that the plugin activates without any errors.

  • Checked the WordPress debug log, which shows that the WC_Simple_Noob_Pay_Gateway class is registered and initialized.

Expected Result:

The “Noob Payment” method should appear as a payment option on the WooCommerce checkout page.

Actual Result:

The checkout page displays the message: “There are no payment methods available. This may be an error on our side. Please contact us if you need any help placing your order.”

Any help in resolving this issue would be greatly appreciated. Thank you!

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