简体   繁体   English

从Wopalommerce中的Paypal成功付款订单状态处理问题

[英]Order status processing issue on successful payment from Paypal in Woocommerce

I am having strange issue and this happens sometimes, when user pay for a course via paypal the order status changed from pending to processing instead of completed. 我有一个奇怪的问题,有时会发生这种情况,当用户通过paypal支付课程时,订单状态从待处理更改为处理而不是已完成。

In this image IPIN notification received but still order is in processing stage, what could causing this issue. 在此图像中收到IPIN通知但仍处于订单处理阶段,可能导致此问题。 I tried to replicate this issue but it does not replicated at my end, It happens sometimes. 我试图复制这个问题,但它没有复制到我的结尾,它有时会发生。

在此输入图像描述

Here is product info: 这是产品信息:

  1. Product is virtual product 产品是虚拟产品
  2. Stock is disabled 股票被禁用

在此输入图像描述

If you are selling only virtual products, you can force order status to "completed" for Paypal on payment complete function, this way: 如果您只销售虚拟产品,您可以强制订单状态为Paypal付款完成功能“完成”,这样:

add_filter('woocommerce_payment_complete_order_status', 'paypal_payment_complete_order_status', 10, 2 );
function paypal_payment_complete_order_status( $status, $order_id, $order ){
    if( $order->get_payment_method() === 'paypal' )
        $status = 'completed';

    return $status;
}

Code goes in function.php file of your active child theme (or active theme). 代码位于活动子主题(或活动主题)的function.php文件中。 Tested and work. 经过测试和工作。

This hook is only triggered on successful payment and has originally 2 possible order status values "processing" or "completed" (depending if "processing" is required) . 此挂钩仅在成功付款时触发,并且最初有2个可能的订单状态值“处理”或“已完成” (取决于是否需要“处理”) So this answer code just force the order status to "completed" targeting Paypal payment gateway (for virtual products) . 所以这个答案代码只是迫使订单状态“完成”定位Paypal支付网关(用于虚拟产品) This hook is located on WC_Order payment_complete() method. 此挂钩位于WC_Order payment_complete()方法上。
All payment gateways use payment_complete() method on a successful payment and Paypal use it on WC_Gateway_Paypal_Response Class. 所有支付网关都使用payment_complete()方法成功付款,Paypal在WC_Gateway_Paypal_Response Class上使用它。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 Woocommerce + Payment (PayPal) - 安全地更新订单状态 + 获取交易 ID - Woocommerce + Payment (PayPal) - Securely update order status + get transaction ID 即使PayPal付款失败,Magento订单状态也会更新为“正在处理” - Magento order status updated to “Processing” even when PayPal payment fails 支付网关的 WooCommerce 订单状态更改 - WooCommerce order status change from payment gateway WooCommerce Paypal 标准网关 - IPN 已收到但订单状态停留在“正在处理” - WooCommerce Paypal Standard Gateway - IPN Received but order status stuck on 'processing' 设置WooCommerce 订单创建时订单状态从processing到pending - Set WooCommerce order status when order is created from processing to pending 从Paypal成功付款获取推荐人信息? - Getting referer info from Paypal successful payment? 在 Woocommerce 中自动更改订单状态从暂停到处理 - Auto change order status from hold-on to processing in Woocommerce 每周一自动更新WooCommerce中的订单状态从处理到完成 - Update order status from processing to completed in WooCommerce automatically on every Monday WooCommerce - 待付款减少库存的订单状态 - WooCommerce - Order Status for Pending Payment Reducing Stock WooCommerce:基于付款方式的订单状态 - WooCommerce: Order status based on Payment methods
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM