Ecommerce Shopify WordPress Discussion

Payment method option is not appearing on the WooCommerce checkout page

I'm attempting to integrate a custom payment method into WooCommerce. I've successfully added the backend option to enable or disable it, but I can't seem to get the custom payment method to appear on the checkout page. I've attached a screenshot of both my admin panel and the frontend checkout page for your reference. Please take a look as I've attempted various solutions but have been unable to resolve the issue. <?php /* Plugin Name: SecureNet Payment Gateway Version: 1.0 Description: Add SecureNet Payment as a payment option in WooCommerce. Author: Your Name */ // Define the custom payment gateway class function custom_payment_gateway_init() { class Custom_Payment_Gateway extends WC_Payment_Gateway { public function __construct() { $this->id = 'custom_payment_gateway'; // Unique ID for your payment gateway $this->method_title = 'Custom Payment Gateway'; $this->method_description = 'Add a custom description here.'; $this->has_fields = true; $this->init_form_fields(); $this->init_settings(); $this->title = $this->get_option('title'); $this->description = $this->get_option('description'); // Add more settings here // ... add_action('woocommerce_update_options_payment_gateways_' . $this->id, array($this, 'process_admin_options')); } public function init_form_fields() { $this->form_fields = array( 'title' => array( 'title' => __('Title', 'woocommerce'), 'type' => 'text', 'description' => __('This controls the title displayed during checkout.', 'woocommerce'), 'default' => __('Custom Payment Gateway', 'woocommerce'), 'desc_tip' => true, ), 'description' => array( 'title' => __('Description', 'woocommerce'), 'type' => 'textarea', 'description' => __('This controls the description displayed during checkout.', 'woocommerce'), 'default' => __('Pay using Custom Payment Gateway', 'woocommerce'), 'desc_tip' => true, ), // Add more fields here // ... ); } public function process_payment($order_id) { // Handle payment processing logic here // Connect to your payment gateway API, redirect to payment page, and confirm payment // Implement error handling and status updates // ... return array( 'result' => 'success', // or 'failure' for unsuccessful payments 'redirect' => $redirect_url, // URL to redirect the customer for payment ); } public function payment_fields() { // Display payment fields such as credit card info or other required info // ... // Example: You can use WooCommerce form fields to capture payment information echo '<div id="custom-payment-gateway-form">'; // Display fields here echo '</div>'; } public function validate_fields() { // Validate payment fields submitted by the customer // Implement validation logic // ... // Example validation: if (empty($_POST['custom_field'])) { wc_add_notice(__('Custom field is required.', 'woocommerce'), 'error'); } } } } // Hook the custom_payment_gateway_init function to plugins_loaded action add_action('plugins_loaded', 'custom_payment_gateway_init'); // Add custom payment gateway to available payment gateways in checkout add_filter('woocommerce_payment_gateways', 'add_custom_payment_gateway'); function add_custom_payment_gateway($gateways) { $gateways[] = 'Custom_Payment_Gateway'; return $gateways; }
TurboCommerce make the better internet purchasing globaly

Turbo Multi-language Translator

Make the better internet purchasing globaly

Turbosify SEO Speed Booster

5.0 (7) Free plan available
Get better conversions by improving store loading speed Installed

Turbo Multi-language Chat - AI Customer service in one hand

TurboCommerce make the better internet purchasing globaly
Our products

The help you need, when you need it

App by Turbo Engine

3 apps • 5.0 average rating

Turbosify Speed Booster

5.0 (7)
Get better conversions by optimizing shopify store Google page speed Installed

Turbosify Translator for Wordpress Woocommerce

5.0 (74) Free Wordpress Woocommerce Plugin
Translate your wordpress website to multiple language within 1 click, no configuration needed, no No technical required

Grow your business here

Whether you want to sell products down the street or around the world, we have all the tools you need.