• hi,
    i install the paypal IPN plugin, and do all settings.
    paypal get status code 200 and the plugin in my site show the complete IPN status.

    how can i automaticly update the order status in WC order list.
    I try to update the Functions.php with this code:

    function get_paypal_order($raw_custom) {
            $custom = json_decode($raw_custom);
            if ($custom && is_object($custom)) {
                $order_id = $custom->order_id;
                $order_key = $custom->order_key;
            } else {
                return false;
            }
            $order = wc_get_order($order_id);
            if (!$order) {
                $order_id = wc_get_order_id_by_order_key($order_key);
                $order = wc_get_order($order_id);
            }
            if (!$order || $order->get_order_key() !== $order_key) {
                return false;
            }
            return $order;
        }
     
        function update_wc_order_status($posted) {
            $order = !empty($posted['custom']) ? get_paypal_order($posted['custom']) : false;
            if ($order) {
                $posted['payment_status'] = strtolower($posted['payment_status']);
                if ('completed' === $posted['payment_status']) {
                    $order->add_order_note(__('IPN payment completed', ''));
                    $order->payment_complete(!empty($posted['txn_id']) ? wc_clean($posted['txn_id']) : '' );
                }
            }
        }
     
        add_action('paypal_ipn_for_wordpress_payment_status_completed', 'update_wc_order_status', 10, 1);
    

    but, some issue apper on my top Dashboard with the function text…

Viewing 1 replies (of 1 total)
  • Hi @mendish Can you share some screenshot of what you are seeing there?
    Normally if the order is a product order then it should be automatically updated to processing ( normal ecommerce way ) and marked complete manually.
    Do you want to skip that manual part and mark order as complete directly as the PayPal stats is completed?

    Did I understand you correct? Or am I missing something?

    Please double check and let me know.
    Thanks!

Viewing 1 replies (of 1 total)
  • The topic ‘Update order status automatic after ipn complete’ is closed to new replies.