Forum Replies Created

Viewing 6 replies - 1 through 6 (of 6 total)
  • Forum: Plugins
    In reply to: [WooCommerce] PAYMENT ISSUE
    Thread Starter huku12345

    (@huku12345)

    I've had a hard time with this, so I'm uploading it because I want to help people who are having trouble with this. Thank you for your kind reply.
    
    
    
    The payment error occurred due to a bug in the “LearnPress – WooCommerce Payment Methods Integration” plugin.
    
    [1] Register the hook below in the class-lp-wc-hooks.php file.
    
    add_action( ‘woocommerce_after_order_object_save’, array( $this, ‘create_lp_order’ ), 10 );
    
    [2] When order information is saved after payment, the function below is executed.
    
    public function create_lp_order( WC_Order $wc_order ) {
    $wc_order_id = $wc_order->get_id();
    $lp_woo_order = new LP_Woo_Order( 0, $wc_order_id );
    $lp_woo_order->create_lp_order();
    }
    
    [3] create_lp_order() of LP_Woo_Order class; If you check the function, you will find the code below.
    
    $wc_order_id = $wc_order->get_id();
    $user_id = get_current_user_id();
    //if is guest checkout, check isset wp user by checkout email
    if ( $user_id === 0 ) {
    $email = $wc_order->get_billing_email();
    $user = get_user_by( 'email', $email );
    if ( $user ) {
    $user_id = $user->ID;
    $wc_order->set_customer_id( $user_id );
    $wc_order->save();
    }
    }
    
    [4] There is no problem when the payment is completed within the site, such as through a bank transfer. However, a problem occurs when returning to the site after the payment is completed through an external PG company.
    [4-1] Because get_current_user_id() is 0
    [4-2] Search for a customer using email information for the order, then set the customer ID for the order.
    [4-3] Save order information. At this time, the Hook registered in [1] is called again and falls into an infinite loop, resulting in a memory error or execution time exceeded error.
    
    As a temporary measure, we have changed function [2] as follows.
    
    public function create_lp_order( WC_Order $wc_order ) {
    remove_action( 'woocommerce_after_order_object_save', array( $this, 'create_lp_order' ), 10 );
    $wc_order_id = $wc_order->get_id();
    $lp_woo_order = new LP_Woo_Order( 0, $wc_order_id );
    $lp_woo_order->create_lp_order();
    add_action( 'woocommerce_after_order_object_save', array( $this, 'create_lp_order' ), 10 );
    }
    For this error, you must request official distribution after correction from the plugin developer, and do not update the plugin until the patch version is distributed.
    
    thank you
    The payment error occurred due to a bug in the “LearnPress – WooCommerce Payment Methods Integration” plugin.
    
    [1] Register the hook below in the class-lp-wc-hooks.php file.
    
    add_action( ‘woocommerce_after_order_object_save’, array( $this, ‘create_lp_order’ ), 10 );
    
    [2] When order information is saved after payment, the function below is executed.
    
    public function create_lp_order( WC_Order $wc_order ) {
    $wc_order_id = $wc_order->get_id();
    $lp_woo_order = new LP_Woo_Order( 0, $wc_order_id );
    $lp_woo_order->create_lp_order();
    }
    
    [3] create_lp_order() of LP_Woo_Order class; If you check the function, you will find the code below.
    
    $wc_order_id = $wc_order->get_id();
    $user_id = get_current_user_id();
    //if is guest checkout, check isset wp user by checkout email
    if ( $user_id === 0 ) {
    $email = $wc_order->get_billing_email();
    $user = get_user_by( 'email', $email );
    if ( $user ) {
    $user_id = $user->ID;
    $wc_order->set_customer_id( $user_id );
    $wc_order->save();
    }
    }
    
    [4] There is no problem when the payment is completed within the site, such as through a bank transfer. However, a problem occurs when returning to the site after the payment is completed through an external PG company.
    [4-1] Because get_current_user_id() is 0
    [4-2] Search for a customer using email information for the order, then set the customer ID for the order.
    [4-3] Save order information. At this time, the Hook registered in [1] is called again and falls into an infinite loop, resulting in a memory error or execution time exceeded error.
    
    As a temporary measure, we have changed function [2] as follows.
    
    public function create_lp_order( WC_Order $wc_order ) {
    remove_action( 'woocommerce_after_order_object_save', array( $this, 'create_lp_order' ), 10 );
    $wc_order_id = $wc_order->get_id();
    $lp_woo_order = new LP_Woo_Order( 0, $wc_order_id );
    $lp_woo_order->create_lp_order();
    add_action( 'woocommerce_after_order_object_save', array( $this, 'create_lp_order' ), 10 );
    }
    For this error, you must request official distribution after correction from the plugin developer, and do not update the plugin until the patch version is distributed.
    
    thank you
    • This reply was modified 8 months, 2 weeks ago by huku12345.
    Forum: Plugins
    In reply to: [WooCommerce] PAYMENT ISSUE
    Thread Starter huku12345

    (@huku12345)

    This is the answer from learnpress woocommerce plugin.

    “Sorry, I see that the payment steps are almost correct, just the payment part is wrong. but woocommerce’s payment methods, so please contact woocommerce to check again.”

    Forum: Plugins
    In reply to: [WooCommerce] PAYMENT ISSUE
    Thread Starter huku12345

    (@huku12345)

    thank you I did as you said and made the payment again and made the same credit card payment, but I got this message: “There are some issues with the items in your cart. Please go back to the cart page and resolve these issues before checking out.” I also contacted the plugin production company.
    Any help possible would be greatly appreciated.

    Forum: Plugins
    In reply to: [WooCommerce] PAYMENT ISSUE
    Thread Starter huku12345

    (@huku12345)

    Thread Starter huku12345

    (@huku12345)

    This problem has been resolved. Thank you

    Thread Starter huku12345

    (@huku12345)

    If a member payment through Woukcommerce, the guest made an order from the RunPress order. I’m asking if there’s a problem with Woocommerce.

Viewing 6 replies - 1 through 6 (of 6 total)