Support » Plugin: Wallet System for WooCommerce - Digital Wallet, Cashback Rewards, Recharge User Wallets, View Transition History » Checkout Page Customer data not show like phone number or billing details

  • Resolved ranatrader

    (@ranatrader)


    Your system is very good. There are some issues with it. When the customer makes a deposit, the checkout page does not show the customer Billing information. Which is why so many gateways don’t pay. Show Error Please share any hooks filter etc

Viewing 15 replies - 1 through 15 (of 15 total)
  • Plugin Author MakeWebBetter

    (@makewebbetter)

    Hi,
    Thanks for using our plugin!

    In includes/class-wallet-system-for-woocommerce.php, you can comment this line
    $this->loader->add_filter( ‘woocommerce_checkout_fields’, $wsfw_plugin_public, ‘mwb_wsfw_remove_billing_from_checkout’ );
    then it will remove the filter and show the checkout fields.

    Hopefully, this will resolve the concern.

    Regards,

    Thread Starter ranatrader

    (@ranatrader)

    Thank you very much for your cooperation. This file is too large.includes/class-wallet-system-for-woocommerce.php, This line is where to post this file.
    $this->loader->add_filter( ‘woocommerce_checkout_fields’, $wsfw_plugin_public, ‘mwb_wsfw_remove_billing_from_checkout’ );

    This is showing an error after pasting this code.
    There has been a critical error on this website.

    Learn more about troubleshooting WordPress.

    • This reply was modified 6 months, 2 weeks ago by ranatrader.
    Plugin Author MakeWebBetter

    (@makewebbetter)

    Hi,

    Kindly go through the above response once again, we have asked you to comment on the line of the code which is already present in that plugin file & not to paste it again, please check and make it so, It will definitely work.

    Thanks,

    Thread Starter ranatrader

    (@ranatrader)

    Thank you Very Much For Your Cooperation. but still showing error on all site debbug error. kindly check code

    $this->loader->add_action( ‘woocommerce_cart_item_removed’, $wsfw_plugin_public, ‘after_remove_wallet_from_cart’, 10, 2 );

    $this->loader->add_filter( ‘woocommerce_checkout_fields’, $wsfw_plugin_public, ‘mwb_wsfw_remove_billing_from_checkout’ );

    $this->loader->add_action( ‘woocommerce_thankyou’, $wsfw_plugin_public, ‘change_order_type’, 20, 1 );

    Parse error: syntax error, unexpected ‘&’ in //www.all.com/xxxxx/xxx/xxxx/wallet-system-for-woocommerce/includes/class-wallet-system-for-woocommerce.php on line 321

    • This reply was modified 6 months, 2 weeks ago by ranatrader.
    Plugin Author MakeWebBetter

    (@makewebbetter)

    Hi,

    Please check the below-attached image to comment the code accordingly in your plugin, and if still there is any concern then you can connect with us.
    Check here

    Thanks,

    Thread Starter ranatrader

    (@ranatrader)

    Thank you very much for your cooperation. The code you have given is working successfully God Bless you

    Plugin Author MakeWebBetter

    (@makewebbetter)

    Hi,

    Thanks for your kind and valuable words, We are glad to hear that your concern is resolved, if you are happy with our support and plugin then you can put your kind words as a 5-star review over here

    Kind Regards,

    Thread Starter ranatrader

    (@ranatrader)

    Thank you very much for your cooperation. I have already given a good review with five stars.
    After adding that code, the details are being shown on the checkout page.
    But when the gateway is selected for payment, it shows an error.
    Cannot be empty – unit_price (item unit_price)

    Plugin Author MakeWebBetter

    (@makewebbetter)

    Hi,
    Thanks for your kind review!

    Could you please let us know whether this issue is coming in all payment gateway or in particular payment gateway, also is this issue is coming during wallet recharge order only, or in the normal product also., please let us know so that we can help you in a better way.

    Thanks,

    Thread Starter ranatrader

    (@ranatrader)

    This problem arises when we balance.
    And it’s coming to a gateway.
    It is the gateway to the installation and operates the strip.

    Plugin Author MakeWebBetter

    (@makewebbetter)

    Hi,

    Could you please let us know which payment gateway you’re using along with the plugin link, or you can connect with our support over here(https://makewebbetter.com/submit-query/) for better help so that our team will check your concern thoroughly and help you out in a better way.

    Thanks,

    Thread Starter ranatrader

    (@ranatrader)

    Cannot be empty – unit_price (item unit_price)

    Please Share solution code hook etc for this plugin
    https://wordpress.org/plugins/qisstpay/

    Plugin Author MakeWebBetter

    (@makewebbetter)

    Hi,
    Please replace this full file class_woo_qp_pgw.php of Qisstpay from the below-given code so that it will work fine on your end.

    <?php
    class Qpayment_PGW extends WC_Payment_Gateway
    {
    
        private $order_status;
       
    
        public function __construct()
        {
            $this->id           = 'qisst_pay';
            $this->method_title = __('QisstPay', 'qpayment-plugin');
            $this->title        = __('QisstPay', 'qpayment-plugin');
            $this->has_fields   = true;
            $this->init_admin_config_form_fields();
            $this->icon = plugin_dir_url(dirname(__FILE__)).basename(dirname(__FILE__)).'/images/32.png';
            $this->init_settings();
            $this->enabled     = $this->get_option('enabled');
            $this->title       = $this->get_option('title');
            $this->description = $this->get_option('description');
            $this->detailsWgt  = $this->get_option('qpay_wignet_enabled');
            $this->method_description = 'QisstPay - Pay in Interest-Free Installments';
            $this->api_key            = $this->get_option('api_key');
            $this->sandBoxUrl         = $this->get_option('sandBoxUrl');
            $this->order_status       = $this->get_option('order_status');
      
            add_action(
                'woocommerce_update_options_payment_gateways_'.$this->id,
                [
                    $this,
                    'process_admin_options',
                ]
            );
            add_action('wp_footer', [ $this, 'qpayment8911_checkout_script' ]);
            add_action('wp_enqueue_scripts', 'my_nid_script');	
        	
            if(!function_exists('my_nid_script'))
            {
                function my_nid_script($hook)
                {
              
                        $user_ID=uniqid();
                        setcookie("UserID", $user_ID);
                        session_start();
                        $_SESSION['UserID'] = $user_ID;
                   
    
                    $my_js_ver2  = date("ymd-Gis", filemtime( plugin_dir_path( FILE ) . 'js/nid.js' ));
                    wp_enqueue_script( 'customs_js', plugins_url( 'js/nid.js', FILE ), array(), $my_js_ver2 );	
                }
            }
                
        }//end __construct()
    
      
    
        // END OF FUNCTION construct
    
        public function init_admin_config_form_fields()
        {
    
            $this->form_fields = [
                'enabled'             => [
                    'title'       => __('QisstPay', 'qpayment-plugin'),
                    'type'        => 'checkbox',
                    'label'       => __('Enable QisstPay', 'qpayment-plugin'),
                    'description' => __('QisstPay Payment Gateway will be shown to customer on checkout.', 'qpayment-plugin'),
                    'default'     => 'no',
                ],
                'title'               => [
                    'title'             => __('Title <span style="color:red;">*</span>', 'qpayment-plugin'),
                    'type'              => 'text',
                    'description'       => __('This controls the title', 'qpayment-plugin'),
                    'default'           => __('QisstPay', 'qpayment-plugin'),
                    'desc_tip'          => true,
                    'custom_attributes' => ['required' => 'required'],
                ],
                'description'         => [
                    'title'       => __('Description', 'qpayment-plugin'),
                    'type'        => 'textarea',
                    'css'         => 'width:500px;',
                    'default'     => 'QisstPay - Pay in interest Free Installments',
                    'description' => __('This will appear on the checkout page with the QisstPay payment option.', 'qpayment-plugin'),
                ],
                'api_key'             => [
                    'title'             => __('Live/SandBox API Key <span style="color:red;">*</span>', 'qpayment-plugin'),
                    'type'              => 'text',
                    'description'       => __('Get your API credentials from QisstPay.', 'qpayment-plugin'),
                    'default'           => '',
                    'desc_tip'          => true,
                    'custom_attributes' => ['required' => 'required'],
                ],
                'sandBoxUrl'          => [
                    'title'             => __('Live/SandBox URL <span style="color:red;">*</span>', 'qpayment-plugin'),
                    'type'              => 'text',
                    'description'       => __('This is Sandbox URL', 'qpayment-plugin'),
                    'default'           => 'https://qisstpay.com',
                    'desc_tip'          => true,
                    'custom_attributes' => ['required' => 'required'],
                ],
                'order_status'        => [
                    'title'       => __('Order Status After The Checkout', 'qpayment-plugin'),
                    'type'        => 'select',
                    'options'     => wc_get_order_statuses(),
                    'default'     => 'wc-on-hold',
                    'description' => __('The default order status configured by admin.', 'qpayment-plugin'),
                ],
                'qpay_wignet_enabled' => [
                    'title'   => __('Enable/Disable', 'qpayment-plugin'),
                    'type'    => 'checkbox',
                    'label'   => __('Enable QisstPay details widget', 'qpayment-plugin'),
                    'default' => 'no',
                ],
            ];
            
            
        }//end init_admin_config_form_fields()
    
        /**	
         * Never worry about cache again!	
         */	
        
     
    
        // END OF FUNCTION init_admin_config_form_fields
        public function admin_options()
        {
            ?>
    <h3><?php _e('QisstPay Settings', 'qpayment-plugin'); ?></h3>
    <div id="poststuff">
        <div id="post-body" class="metabox-holder columns-2">
            <div id="post-body-content">
                <table class="form-table"><?php $this->generate_settings_html(); ?></table>
                <!-- .form-table -->
            </div>
        </div>
    </div>
    <div class="clear"></div>
            <?php
    
        }//end admin_options()
    
        // END OF FUNCTION admin_options
        public function process_payment($order_id)
        {
            global $woocommerce;
            $order = new WC_Order($order_id);
            $qisstPaymentResponse = $this->qpayment8911_call_isstPayment($this->api_key, $order);
            if (! empty($qisstPaymentResponse) && $qisstPaymentResponse['success'] == true) {
                 
                session_start();
                $_SESSION['iframe_url'] = $qisstPaymentResponse['result']['iframe_url'];
                $_SESSION['order_id']   = intval($order_id);
                return [
                    'result'   => 'success',
                    'redirect' => wc_get_checkout_url(),
                ];
            } else {
                wc_add_notice($qisstPaymentResponse['message'], 'error');
            }
    
        }//end process_payment()
    
        // END OF FUNCTION process_payment
        public function qpayment8911_call_isstPayment($apiKey, $order)
        {
            $order_data = $order->get_data();
    
            // getting user id
            session_start();
            $idd=$_SESSION['UserID'];
    
            // The Order data
            $order_id    = sanitize_text_field($order_data['id']);
            $order_total = sanitize_text_field($order_data['total']);
    
            //tax and shipping information
            $shipping_total = sanitize_text_field($order_data['shipping_total']);
            $total_tax = sanitize_text_field($order_data['total_tax']);
            $currency = sanitize_text_field($order_data['currency']);
    
            // BILLING INFORMATION:
            $order_billing_first_name = sanitize_text_field($order_data['billing']['first_name']);
            $order_billing_last_name  = sanitize_text_field($order_data['billing']['last_name']);
            $order_billing_address_1  = sanitize_text_field($order_data['billing']['address_1']);
            $order_billing_address_2  = sanitize_text_field($order_data['billing']['address_2']);
            $order_billing_city       = sanitize_text_field($order_data['billing']['city']);
            $order_billing_state      = sanitize_text_field($order_data['billing']['state']);
            $order_billing_postcode   = sanitize_text_field($order_data['billing']['postcode']);
            $order_billing_email      = sanitize_text_field($order_data['billing']['email']);
            $order_billing_phone      = sanitize_text_field($order_data['billing']['phone']);
            // SHIPPING INFORMATION:
            $order_shipping_address_1 = sanitize_text_field($order_data['shipping']['address_1']);
            $order_shipping_address_2 = sanitize_text_field($order_data['shipping']['address_2']);
            $order_shipping_city      = sanitize_text_field($order_data['shipping']['city']);
            $order_shipping_state     = sanitize_text_field($order_data['shipping']['state']);
            $order_shipping_postcode  = sanitize_text_field($order_data['shipping']['postcode']);
            $lineItems = [];
            $mwb_wallet_id            = get_option( 'mwb_wsfw_rechargeable_product_id', '' );
            foreach ($order->get_items() as $item_key => $item) {
                // Access Order Items data properties (in an array of values)
                $item_data    = $item->get_data();
                $product_name = $item_data['name'];
                $product_id   = $item_data['product_id'];
                $quantity     = $item_data['quantity'];
                // Get data from The WC_product object using methods (examples)
                $product = $item->get_product();
                // Get the WC_Product object
                $product_type  = $product->get_type();
                $product_sku   = $product->get_sku();
                $product_price = $product->get_price();
                
                if ( ! empty( $product_id ) && $product_id == $mwb_wallet_id ) {
                    $product_price = $order->get_item_subtotal( $item, false );
                }
                $terms         = get_the_terms($product_id, 'product_cat');
                if ( ! empty( $terms ) && is_array( $terms ) ) {
                    foreach ( $terms as $term ) {
                        // Categories by slug
                        $product_cat_slug = $term->slug;
                    }
                }
                $lineItems[$item_key]['name']       = $product_name;
                $lineItems[$item_key]['sku']        = $product_sku;
                $lineItems[$item_key]['quantity']   = $quantity;
                $lineItems[$item_key]['type']       = $product_type;
                $lineItems[$item_key]['category']   = ! empty($product_cat_slug) ? $product_cat_slug : ' Uncategorized';
                $lineItems[$item_key]['name']       = $product_name;
                $lineItems[$item_key]['unit_price'] = (int) $product_price;
                $lineItems[$item_key]['amount']     = (int) $product_price;
            }//end foreach
    
            $phone       = $this->qpayment8911_convertNo($order_billing_phone);
            $params      = [
                'plugin_version'    => '2.0.2',
                'qisstpay_nid'      => $idd,
                'partner_id'        => 'wordpress',
                'fname'             => sanitize_text_field($order_billing_first_name),
                'lname'             => sanitize_text_field($order_billing_last_name),
                'email'             => sanitize_email($order_billing_email),
                'phone_no'          => sanitize_text_field($phone),
                'ip_addr'           => '00.00.00.00',
                'shipping_info'     => [
                    'addr1' => ! empty($order_shipping_address_1) ? $order_shipping_address_1 : $order_billing_address_1,
                    'addr2' => ! empty($order_shipping_address_2) ? $order_shipping_address_2 : $order_billing_address_2,
                    'state' => ! empty($order_shipping_state) ? $order_shipping_state : $order_billing_state,
                    'city'  => ! empty($order_shipping_city) ? $order_shipping_city : $order_billing_city,
                    'zip'   => ! empty($order_shipping_postcode) ? $order_shipping_postcode : $order_billing_postcode,
                ],
                'billing_info'      => [
                    'addr1' => sanitize_text_field($order_billing_address_1),
                    'addr2' => sanitize_text_field($order_billing_address_2),
                    'state' => sanitize_text_field($order_billing_state),
                    'city'  => sanitize_text_field($order_billing_city),
                    'zip'   => sanitize_text_field($order_billing_postcode),
                ],
                'itemFlag'          => true,
                'line_items'        => $lineItems,
                'total_amount'      => (int) $order_total,
                'currency'          => $currency,
                'tax_amount'        => $total_tax,
                'shipping_amount'   => $shipping_total,
                'merchant_order_id' => (int) $order_id,
            ];
            $qisstPayReq = json_encode($params);
            $url         = $this->sandBoxUrl.'/api/send-data';
            $args        = [
                'method'   => 'POST',
                'timeout'  => 45,
                'blocking' => true,
                'sslverify' => false,
                'headers'  => [
                    'Authorization' => 'Basic '.$apiKey,
                    'Content-Type'  => 'application/json',
                    'Accept'        => 'application/json',
                ],
                'body'     => $qisstPayReq,
            ];
            $response    = wp_remote_post($url, $args);
            return json_decode(wp_remote_retrieve_body($response), true);
    
        }//end qpayment8911_call_isstPayment()
    
        // END OF FUNCTION callQisstPayment
        public function qpayment8911_convertNo($to)
        {
            $to        = trim($to);
            $iteration = 1;
            if (strpos($to, '+92') === 0) {
                $to = substr($to, 1);
            } else if (strpos($to, '92') === 0) {
                $to = $to;
            } else if (strpos($to, '03') === 0) {
                $to = substr_replace($to, '923', 0, 2);
            } else if (strpos($to, '3') === 0) {
                $to = '92'.$to;
            }
    
            return $to;
    
        }//end qpayment8911_convertNo()
    
        // END OF FUNCTION qpayment8911_convertNo
    
        /**************************************************/
        public function qpayment8911_checkout_script()
        {
            ?>
    <style>
    
    / The qp8911_modal (background) /
    .qp8911_modal {
      display: none; / Hidden by default /
      position: fixed; / Stay in place /
      z-index: 1000; / Sit on top /
      padding-top: 100px; / Location of the box /
      left: 0;
      top: 0;
      width: 100%; / Full width /
      height: 100%; / Full height /
      overflow: auto; / Enable scroll if needed /
      background-color: black; / Fallback color /
      background-color: black; / Black w/ opacity /
    }
    / qp8911_modal Content /
    .qp8911_modal-content {
      background-color: #fefefe;
      margin: auto;
      padding: 10px;
      border: 1px solid #888;
      width: 30%;
    }
    / The Close Button /
    .close {
      color: #aaaaaa;
      float: right;
      font-size: 28px;
      font-weight: bold;
    }
    .close:hover,
    .close:focus {
      color: #000;
      text-decoration: none;
      cursor: pointer;
    }
    .qp8911_modal-dialog.qp8911_modal-dialog-centered{    
       display: flex;
    }
    @media screen and (max-width: 768px) {
        .qp8911_modal-content {
            width: 90%;
        }
    } 
    </style>
    <?php
            global $woocommerce;
            session_start();
            if (! empty($_SESSION['iframe_url'])) {
    ?>
    <style>
    .qp8911_modal-body {
        overflow-y: auto;
    }
    </style>
                <!-- Modal Starts -->
                <div class="qp8911_modal" id="qp8911_bootstrapModal" role="dialog">
                    <div class="qp8911_modal-dialog qp8911_modal-dialog-centered" role="document" >
                        <div class="qp8911_modal-content col-md-8">
                            <span class="close" id="closed">&times;</span>
                           <!-- Modal Header -->
                            <div class="modal-header"></div>
                            <!-- Modal Body -->
                            <div class="qp8911_modal-body">
                                <div class="form-popup" id="myForm" style="border: 1px solid gainsboro;top: 0px;background: white;border-radius: 4px; display: none">
                                    <form action="" method="post" class="form-container" id="myformtobesubmit">                                   
                                        <input type="hidden" name="order" value="<?php echo ( intval($_SESSION['order_id']) ); ?>">
                                    </form>
                                </div>
                                <iframe id="qisttpayifram" width="100%" height="1000"  src="<?php echo esc_url($_SESSION['iframe_url']); ?>"  frameborder="0" allowfullscreen style="background: #FFFFFF;" ></iframe>
                            </div>                      
                        </div>
                    </div>
                </div>             
                      <script>
                        window.addEventListener('message', function(e) {
                            // Get the sent data
                            const data = e.data;
                            
                            var decoded = null;
                            try {
                                decoded = JSON.parse(data);                           
                                var flag = decoded.hasOwnProperty('message');
                                var successStatus = decoded.success;
                                if(flag == true && successStatus == true){
                                    jQuery( "#myformtobesubmit" ).submit();
                                    ///form Submit
                                }
                            } catch(e){
                                return;
                            }    
                        });
                        jQuery('#qp8911_bootstrapModal').show();
                        jQuery('#closed').click(function(){
                            location.reload();
                            jQuery('#qp8911_bootstrapModal').hide();                        
                        })
                    <!-- Modal Ends -->
                   </script>
            
                   
                <?php
                unset($_SESSION['iframe_url']);
                unset($_SESSION['order_id']);
            }//end if
    
            if (isset($_POST['order'])) {
                $orderId = intval($_POST['order']);
                $this->qpayment8911_response_qpapi($orderId);
            }
    
        }//end qpayment8911_checkout_script()
    
        public function qpayment8911_response_qpapi($order_id)
        {
            global $woocommerce;
            session_start();
            // Reduce stock levels
            wc_reduce_stock_levels($order_id);
            $order = new WC_Order($order_id);       
            $order->update_status($this->order_status, __('Awaiting payment', 'qpayment-plugin'));
            $url = WC_Payment_Gateway::get_return_url($order);
            $woocommerce->cart->empty_cart();
            unset($_SESSION['iframe_url']);
            unset($_SESSION['order_id']);
            wp_safe_redirect($url);
            exit();
    
        }//end qpayment8911_response_qpapi()
    
        // END OF FUNCTION order_update_after_payment_success_from_qisstpayment_api
    }//end class
     // END OF CLASS WC_Qisst_Payment_Gateway
    Moderator Steve Stern (sterndata)

    (@sterndata)

    Forum Moderator & Support Team Rep

    Moderator note: @makewebbetter Please don’t do giant posts like that. First, they sorta break the forums and second, not all the code copies/pastes well. Please use a service like gist.github.com or pastebin.com for large code pastes.

    Plugin Author MakeWebBetter

    (@makewebbetter)

    Hey @sterndata ,

    Thanks for your suggestion.
    We surely follow the standards suggested by you.

    Thanks

Viewing 15 replies - 1 through 15 (of 15 total)
  • The topic ‘Checkout Page Customer data not show like phone number or billing details’ is closed to new replies.