简体   繁体   中英

Woocommerce does not read the address

I started getting an error on my woocommerce checkout page. I add all the necessary data (name, address, mobile phone, email...) and when I click to finish, the website doesn't assume my address, it's as if it wasn't there. I activated the debug mode and it is returning me two errors. Could any of these errors be related to my problem? I'll leave the errors below, as well as the corresponding line of code. And thanks in advance to anyone who tries to help me.

Error 1:

PHP Warning:  mysqli::__construct(): (HY000/1045): Access denied for user 'my_user'@'localhost' (using password: YES) in /home/aplako/contas/plako/combperelhal.com/www/wp-content/themes/divi-business-pro/functions.php on line 7

Line 7 of functions php (it's the first line):

$mysqli = new mysqli("localhost", "my_user", "my_password", "world");

Error 2:

PHP Warning:  session_start(): Cannot start session when headers already sent in /home/aplako/contas/plako/combperelhal.com/www/wp-content/plugins/sibs-woocommerce/class-sibs-payment-gateway.php on line 236

Line 236 is the last line of this function but I thought it best to leave the whole function here.

function sibs_init_payment_gateway() {

    /**
     * Loads the Sibs language translation strings
     */
    load_plugin_textdomain( 'wc-sibs', false, dirname( plugin_basename( __FILE__ ) ) . '/languages/' );

    if ( ! class_exists( 'WC_Payment_Gateway' ) ) {
        add_action( 'admin_notices', 'sibs_get_notice_woocommerce_activation' );
        return;
    } else {
        add_action( 'admin_notices', 'validate_sibs_term' );
    }

    include_once dirname( __FILE__ ) . '/includes/class-general-functions.php';
    include_once dirname( __FILE__ ) . '/includes/class-general-models.php';
    include_once dirname( __FILE__ ) . '/includes/admin/class-sibs-general-settings.php';
    include_once dirname( __FILE__ ) . '/includes/admin/class-sibs-backend-settings.php';
    include_once dirname( __FILE__ ) . '/includes/core/class-sibspaymentcore.php';
    include_once dirname( __FILE__ ) . '/includes/core/class-sibserrorhandler.php';
    include_once dirname( __FILE__ ) . '/includes/core/class-sibsversiontracker.php';

    if ( ! class_exists( 'Sibs_Payment_Gateway' ) ) {

        
        class Sibs_Payment_Gateway extends WC_Payment_Gateway {
            
            protected $payment_id;
        
            protected $payment_type;
        
            protected $payment_brand;
            
            protected $language;
            
            protected $payment_group;
            
            protected $payment_display = 'form';
            
            private static $saved_meta_boxes = false;
            
            private static $added_meta_boxes = false;
            
            private static $added_payment_method = false;
            
            private static $updated_meta_boxes = false;
            
            protected $wc_order;

            
            public function __construct() {
                $this->payment_id    = $this->id;
                $payment_gateway     = Sibs_General_Functions::sibs_get_payment_gateway_variable( $this->payment_id );
                $this->payment_type  = $payment_gateway['payment_type'];
                $this->payment_brand = $payment_gateway['payment_brand'];
                $this->payment_group = $payment_gateway['payment_group'];
                $this->language      = $payment_gateway['language'];
                $this->plugins_url   = Sibs_General_Functions::sibs_get_plugin_url();

                $this->form_fields  = Sibs_Backend_Settings::sibs_create_backend_payment_settings( $this->payment_id );
                $this->method_title = Sibs_Backend_Settings::sibs_backend_payment_title( $this->payment_id );
                $this->method_description = Sibs_Backend_Settings::sibs_backend_payment_desc( $this->payment_id );
                
                $this->init_settings();

                // Save admin configuration from woocomerce checkout tab.
                add_action( 'woocommerce_update_options_payment_gateways_' . $this->id, array( $this, 'process_admin_options' ) );
                // Frontend hook.
                add_action( 'woocommerce_receipt_' . $this->payment_id, array( &$this, 'sibs_receipt_page' ) );

                add_action( 'woocommerce_thankyou_' . $this->payment_id, array( &$this, 'thankyou_page' ) );
                // Backend hook.
                add_action( 'woocommerce_process_shop_order_meta', array( &$this, 'sibs_save_order_meta' ) );
                add_action( 'woocommerce_admin_order_data_after_order_details', array( &$this, 'sibs_update_order_status' ) );
                add_action( 'woocommerce_admin_order_data_after_billing_address', array( &$this, 'add_payment_method' ) );
                add_action( 'woocommerce_admin_order_data_after_shipping_address', array( &$this, 'sibs_add_additional_information' ) );

                // Added for Capture
                
                /**
                 * hook to add the ajax callback
                 */
                global $action_addded_my_function_to_add_the_product;
                if (!$action_addded_my_function_to_add_the_product) {
                    add_action( 'wp_ajax_add_my_product_to_order', array( &$this,'sibs_my_function_to_add_the_product') );
                    $action_addded_my_function_to_add_the_product = true;
                }

                //custom email  
                add_action( 'woocommerce_email_order_meta', array( &$this, 'sibs_add_multibanco_data_to_order_email'), 10, 4 );

                // Add a custom metabox only for shop_order post type (order edit pages)
                add_action( 'add_meta_boxes', array( &$this, 'sibs_add_meta_boxesws' ) );
                
                //WebHook
                add_action( 'rest_api_init', function(){
                    register_rest_route(
                        'sibs-api/v1',
                        '/callback_hook',
                        array(
                            'methods'  => 'POST',
                            'permission_callback' => '__return_true',
                            'callback' => array( &$this,'callback_hook'),
                            )
                    );
                } );


                // Enable woocommerce refund for {payment gateway}.
                $this->supports = array( 'refunds' );

                if ( isset( WC()->session->sibs_thankyou_page ) ) {
                    unset( WC()->session->sibs_thankyou_page );
                }
                if ( isset( WC()->session->pmtRef ) ) {
                    unset( WC()->session->pmtRef );
                }

                if ( isset( WC()->session->ptmntEntty ) ) {
                    unset( WC()->session->ptmntEntty );
                }

                if ( isset( WC()->session->refIntlDtTm ) ) {
                    unset( WC()->session->refIntlDtTm );
                }

                if ( isset( WC()->session->RefLmtDtTm ) ) {
                    unset( WC()->session->RefLmtDtTm );
                }

                if ( isset( WC()->session->sibs_receipt_page ) ) {
                    unset( WC()->session->sibs_receipt_page );
                }
                if ( isset( WC()->session->sibs_confirmation_page ) ) {
                    unset( WC()->session->sibs_confirmation_page );
                }
                if ( !session_id()  && empty(session_id())) {
                    session_start( [
                        'read_and_close' => true,
                    ] );
                }
            }

Access denied for user 'my_user'@'localhost' (using password: YES)

The first error indicates that your PHP script cannot access the MySQL database.

Have you verified that the user / password / hostname of the database are correct?

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM