• Resolved fabianpacheco

    (@fabianpacheco)


    I am developing a payment gateway plugin for woocommerce and I am having an error on the store page, although I am trying with a base plugin that I found on the web, the checkbox does not appear on the checkout page.
    At first I thought I was coding it wrong, then I found a tutorial with a base plugin and it worked for the person, I tried the same code and for me it didn’t work.

    This is the page:

    I am desperate because I have searched all over the internet and no solution has helped me, it is probably something simple and I am not seeing it, I don’t know. I need help please

    This is my system report

    `
    ### WordPress Environment ###
    
    WordPress address (URL): https://localhost:8000
    Site address (URL): https://localhost:8000
    WC Version: 8.5.1
    REST API Version: ? 8.5.1
    WC Blocks Version: ? 11.8.0-dev
    Action Scheduler Version: ? 3.7.1
    Log Directory Writable: ?
    WP Version: 6.4.2
    WP Multisite: –
    WP Memory Limit: 256 MB
    WP Debug Mode: –
    WP Cron: ?
    Language: en_US
    External object cache: –
    
    ### Server Environment ###
    
    Server Info: Apache/2.4.57 (Debian)
    PHP Version: 8.2.14
    PHP Post Max Size: 8 MB
    PHP Time Limit: 30
    PHP Max Input Vars: 1000
    cURL Version: 7.88.1
    OpenSSL/3.0.11
    
    SUHOSIN Installed: –
    MySQL Version: 11.2.2-MariaDB-1:11.2.2+maria~ubu2204
    Max Upload Size: 2 MB
    Default Timezone is UTC: ?
    fsockopen/cURL: ?
    SoapClient: ? Your server does not have the SoapClient class enabled - some gateway plugins which use SOAP may not work as expected.
    DOMDocument: ?
    GZip: ?
    Multibyte String: ?
    Remote Post: ?
    Remote Get: ?
    
    ### Database ###
    
    WC Database Version: 8.5.1
    WC Database Prefix: wp_
    Total Database Size: 6.29MB
    Database Data Size: 4.59MB
    Database Index Size: 1.70MB
    wp_woocommerce_sessions: Data: 0.02MB + Index: 0.02MB + Engine InnoDB
    wp_woocommerce_api_keys: Data: 0.02MB + Index: 0.03MB + Engine InnoDB
    wp_woocommerce_attribute_taxonomies: Data: 0.02MB + Index: 0.02MB + Engine InnoDB
    wp_woocommerce_downloadable_product_permissions: Data: 0.02MB + Index: 0.06MB + Engine InnoDB
    wp_woocommerce_order_items: Data: 0.02MB + Index: 0.02MB + Engine InnoDB
    wp_woocommerce_order_itemmeta: Data: 0.02MB + Index: 0.03MB + Engine InnoDB
    wp_woocommerce_tax_rates: Data: 0.02MB + Index: 0.06MB + Engine InnoDB
    wp_woocommerce_tax_rate_locations: Data: 0.02MB + Index: 0.03MB + Engine InnoDB
    wp_woocommerce_shipping_zones: Data: 0.02MB + Index: 0.00MB + Engine InnoDB
    wp_woocommerce_shipping_zone_locations: Data: 0.02MB + Index: 0.03MB + Engine InnoDB
    wp_woocommerce_shipping_zone_methods: Data: 0.02MB + Index: 0.00MB + Engine InnoDB
    wp_woocommerce_payment_tokens: Data: 0.02MB + Index: 0.02MB + Engine InnoDB
    wp_woocommerce_payment_tokenmeta: Data: 0.02MB + Index: 0.03MB + Engine InnoDB
    wp_woocommerce_log: Data: 0.02MB + Index: 0.02MB + Engine InnoDB
    wp_actionscheduler_actions: Data: 0.02MB + Index: 0.11MB + Engine InnoDB
    wp_actionscheduler_claims: Data: 0.02MB + Index: 0.02MB + Engine InnoDB
    wp_actionscheduler_groups: Data: 0.02MB + Index: 0.02MB + Engine InnoDB
    wp_actionscheduler_logs: Data: 0.02MB + Index: 0.03MB + Engine InnoDB
    wp_commentmeta: Data: 0.02MB + Index: 0.03MB + Engine InnoDB
    wp_comments: Data: 0.02MB + Index: 0.09MB + Engine InnoDB
    wp_links: Data: 0.02MB + Index: 0.02MB + Engine InnoDB
    wp_options: Data: 3.50MB + Index: 0.06MB + Engine InnoDB
    wp_postmeta: Data: 0.02MB + Index: 0.03MB + Engine InnoDB
    wp_posts: Data: 0.06MB + Index: 0.06MB + Engine InnoDB
    wp_termmeta: Data: 0.02MB + Index: 0.03MB + Engine InnoDB
    wp_terms: Data: 0.02MB + Index: 0.03MB + Engine InnoDB
    wp_term_relationships: Data: 0.02MB + Index: 0.02MB + Engine InnoDB
    wp_term_taxonomy: Data: 0.02MB + Index: 0.03MB + Engine InnoDB
    wp_usermeta: Data: 0.02MB + Index: 0.03MB + Engine InnoDB
    wp_users: Data: 0.02MB + Index: 0.05MB + Engine InnoDB
    wp_wc_admin_notes: Data: 0.06MB + Index: 0.00MB + Engine InnoDB
    wp_wc_admin_note_actions: Data: 0.05MB + Index: 0.02MB + Engine InnoDB
    wp_wc_category_lookup: Data: 0.02MB + Index: 0.00MB + Engine InnoDB
    wp_wc_customer_lookup: Data: 0.02MB + Index: 0.03MB + Engine InnoDB
    wp_wc_download_log: Data: 0.02MB + Index: 0.03MB + Engine InnoDB
    wp_wc_orders: Data: 0.02MB + Index: 0.11MB + Engine InnoDB
    wp_wc_orders_meta: Data: 0.02MB + Index: 0.03MB + Engine InnoDB
    wp_wc_order_addresses: Data: 0.02MB + Index: 0.06MB + Engine InnoDB
    wp_wc_order_coupon_lookup: Data: 0.02MB + Index: 0.03MB + Engine InnoDB
    wp_wc_order_operational_data: Data: 0.02MB + Index: 0.03MB + Engine InnoDB
    wp_wc_order_product_lookup: Data: 0.02MB + Index: 0.06MB + Engine InnoDB
    wp_wc_order_stats: Data: 0.02MB + Index: 0.05MB + Engine InnoDB
    wp_wc_order_tax_lookup: Data: 0.02MB + Index: 0.03MB + Engine InnoDB
    wp_wc_product_attributes_lookup: Data: 0.02MB + Index: 0.02MB + Engine InnoDB
    wp_wc_product_download_directories: Data: 0.02MB + Index: 0.02MB + Engine InnoDB
    wp_wc_product_meta_lookup: Data: 0.02MB + Index: 0.09MB + Engine InnoDB
    wp_wc_rate_limits: Data: 0.02MB + Index: 0.02MB + Engine InnoDB
    wp_wc_reserved_stock: Data: 0.02MB + Index: 0.00MB + Engine InnoDB
    wp_wc_tax_rate_classes: Data: 0.02MB + Index: 0.02MB + Engine InnoDB
    wp_wc_webhooks: Data: 0.02MB + Index: 0.02MB + Engine InnoDB
    
    ### Post Type Counts ###
    
    attachment: 2
    page: 7
    post: 2
    product: 1
    shop_order_placehold: 2
    wp_global_styles: 2
    wp_navigation: 1
    wp_template: 2
    
    ### Security ###
    
    Secure connection (HTTPS): ?
    					Your store is not using HTTPS. Learn more about HTTPS and SSL Certificates.
    Hide errors from visitors: ?
    
    ### Active Plugins (6) ###
    
    FOSI Pago: by Cristian Talá – 1.0.0
    Woocommerce payment gateway plugin: by Fabian Pacheco – 1.0.0
    Plugin Prueba: by Fabian – 1.0
    Relative URL: by Tunghsiao Liu – 0.1.8
    WooCommerce Dummy Payments Gateway: by SomewhereWarm – 1.0.6
    WooCommerce: by Automattic – 8.5.1
    
    ### Inactive Plugins (2) ###
    
    Akismet Anti-spam: Spam Protection: by Automattic - Anti-spam Team – 5.3
    Hello Dolly: by Matt Mullenweg – 1.7.2
    
    ### Settings ###
    
    API Enabled: –
    Force SSL: –
    Currency: CLP ($)
    Currency Position: left
    Thousand Separator: .
    Decimal Separator: ,
    Number of Decimals: 0
    Taxonomies: Product Types: external (external)
    grouped (grouped)
    simple (simple)
    variable (variable)
    
    Taxonomies: Product Visibility: exclude-from-catalog (exclude-from-catalog)
    exclude-from-search (exclude-from-search)
    featured (featured)
    outofstock (outofstock)
    rated-1 (rated-1)
    rated-2 (rated-2)
    rated-3 (rated-3)
    rated-4 (rated-4)
    rated-5 (rated-5)
    
    Connected to Woo.com: –
    Enforce Approved Product Download Directories: ?
    HPOS feature screen enabled: ?
    HPOS feature enabled: ?
    Order datastore: Automattic\WooCommerce\Internal\DataStores\Orders\OrdersTableDataStore
    HPOS data sync enabled: –
    
    ### WC Pages ###
    
    Shop base: #7 - /?page_id=7
    Cart: #8 - /?page_id=8
    Checkout: #9 - /?page_id=9
    My account: #10 - /?page_id=10
    Terms and conditions: ? Page not set
    
    ### Theme ###
    
    Name: Gadgethub
    Version: 1.0.1
    Author URL: https://omnipressteam.com/
    Child Theme: ? – If you are modifying WooCommerce on a parent theme that you did not build personally we recommend using a child theme. See: How to create a child theme
    WooCommerce Support: ? Not declared
    
    ### Templates ###
    
    Overrides: gadgethub/templates/archive-product.html
    gadgethub/templates/order-confirmation.html
    gadgethub/templates/product-search-results.html
    gadgethub/templates/single-product.html
    
    
    ### Admin ###
    
    Enabled Features: activity-panels
    analytics
    product-block-editor
    coupons
    core-profiler
    customer-effort-score-tracks
    import-products-task
    experimental-fashion-sample-products
    shipping-smart-defaults
    shipping-setting-tour
    homescreen
    marketing
    mobile-app-banner
    navigation
    onboarding
    onboarding-tasks
    product-variation-management
    product-virtual-downloadable
    product-external-affiliate
    product-grouped
    remote-inbox-notifications
    remote-free-extensions
    payment-gateway-suggestions
    shipping-label-banner
    subscriptions
    store-alerts
    transient-notices
    woo-mobile-welcome
    wc-pay-promotion
    wc-pay-welcome-page
    
    Disabled Features: customize-store
    minified-js
    new-product-management-experience
    product-linked
    settings
    async-product-editor-category-field
    
    Daily Cron: ? Next scheduled: 2024-01-18 14:48:37 +00:00
    Options: ?
    Notes: 63
    Onboarding: completed
    
    ### Action Scheduler ###
    
    Complete: 10
    Oldest: 2024-01-17 15:00:28 +0000
    Newest: 2024-01-17 18:03:12 +0000
    
    Pending: 4
    Oldest: 2024-01-17 18:03:39 +0000
    Newest: 2024-01-18 15:00:28 +0000
    
    Failed: 2
    Oldest: 2024-01-17 15:00:28 +0000
    Newest: 2024-01-17 15:01:34 +0000
    
    
    ### Status report information ###
    
    Generated at: 2024-01-17 19:46:23 +00:00
    `

    this is the code of plugin that i testing:

    <?php
    
    /*
    Plugin Name: Plugin Prueba
    Plugin URI: https://www.google.com
    Description: Plugin de prueba
    Version: 1.0
    Author: Fabian
    Author URI: https://www.google.com
    License: GPLv2 or later
    Text Domain: plugin-prueba
    */
    
    use WC_Order;
    
    
    add_action('plugins_loaded', 'wdm_init_gateway_class');
    
    function wdm_init_gateway_class() {
        class WDM_Custom_Payment_Gateway extends WC_Payment_Gateway {
            public function __construct() {
                $this->id = 'wdm_custom_payment_gateway';
                $this->icon = null;
                $this->has_fields = false;
                $this->method_title = __('WDM Custom Payment Gateway', 'wdm-custom-payment-gateway');
                $this->method_description = __('WDM Payment Gateway for WooCommerce', 'wdm-custom-payment-gateway');
                $this->supports = array('products');
    
                $this->init_form_fields();
                $this->init_settings();
    
                $this->enabled = $this->get_option('enabled');
                $this->title = $this->get_option('title');
                $this->description = $this->get_option('description');
    
                add_action('woocommerce_update_options_payment_gateways_' . $this->id, array($this, 'process_admin_options'));
                add_action('woocommerce_api_' . strtolower(get_class($this)), array($this, 'webhook_handler'));
            }
    
            public function init_form_fields() {
                $this->form_fields = array(
                    'enabled' => array(
                        'title' => __('Enable/Disable', 'wdm-custom-payment-gateway'),
                        'type' => 'checkbox',
                        'label' => __('Enable Custom Payment', 'wdm-custom-payment-gateway'),
                        'default' => 'yes',
                    ),
                    'title' => array(
                        'title' => __('Title', 'wdm-custom-payment-gateway'),
                        'type' => 'text',
                        'description' => __('This controls the title which the user sees during checkout.', 'wdm-custom-payment-gateway'),
                        'default' => __('Custom Payment', 'wdm-custom-payment-gateway'),
                        'desc_tip' => true,
                    ),
                    'description' => array(
                        'title' => __('Customer Message', 'wdm-custom-payment-gateway'),
                        'type' => 'textarea',
                        'default' => '',
                    ),
                );
            }
    
            public function process_payment($order_id) {
                $order = wc_get_order($order_id);
                $order->update_status('on-hold', __('Awaiting cheque payment', 'woocommerce'));
                $order->reduce_order_stock();
                wc_empty_cart();
    
                return array(
                    'result' => 'success',
                    'redirect' => $this->get_return_url($order),
                );
            }
        }
    }
    
    function wdm_add_payment_gateway_list($methods) {
        $methods[] = 'WDM_Custom_Payment_Gateway';
        return $methods;
    }
    
    add_filter('woocommerce_payment_gateways', 'wdm_add_payment_gateway_list');
    
    • This topic was modified 9 months, 1 week ago by fabianpacheco.
    • This topic was modified 9 months, 1 week ago by James Huff. Reason: link moved to the proper field

    The page I need help with: [log in to see the link]

Viewing 3 replies - 1 through 3 (of 3 total)
Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘There are no payment methods available.’ is closed to new replies.