• Resolved Morgan Hvidt

    (@morganhvidt)


    Hey team,

    We’ve been facing this issue for quite a while and have to make our own patch with each update.

    Related file: woocommerce-shipstation-integration/includes/api-requests/class-wc-shipstation-api-export.php?

    The issue:
    The date calculations aren’t working on our site, and sure it’s also the reason for other “orders missing” type of tickets. The query to fetch all orders between the start and end date returns no orders, even if there are any.
    I haven’t looked into which exact dates the the query uses as we needed a quick fix.

    The fix:
    We override the plugins code in the file above. The code I’ve changed is to export all modifed orders since 2 days ago. This means all new/updated orders will be included. This way we don’t need an “end” date, incase that’s where the original code goes wrong.

        $date = new DateTime(); // HOT FIX
        $date->modify("-2 day"); // HOT FIX
    
        $orders_to_export = wc_get_orders(
            array(
                'date_modified' => '>=' . $date->format("Y-m-d"), // HOT FIX
                //'date_modified' => strtotime( $start_date )  . '...' . strtotime( $end_date ), // Incorrect
                'type'          => 'shop_order',
                'status'        => WC_ShipStation_Integration::$export_statuses,
                'return'        => 'ids',
                'orderby'       => 'date_modified',
                'order'         => 'DESC',
                'paged'         => $page,
                'limit'         => WC_SHIPSTATION_EXPORT_LIMIT,
            )
        );
    
        $total_orders_to_export = wc_get_orders(
            array(
                'type'          => 'shop_order',
                'date_modified' => '>=' . $date->format("Y-m-d"), // HOT FIX
                //'date_modified' => strtotime( $start_date ) . '...' . strtotime( $end_date ), // Incorrect
                'status'        => WC_ShipStation_Integration::$export_statuses,
                'paginate'      => true,
                'return'        => 'ids',
            )
        );

    Please look into this, thank you very much ??

Viewing 1 replies (of 1 total)
  • Plugin Support katerinaz – a11n

    (@katerinaz)

    Hello @morganhvidt !
    Can you please walk us through the process here? How do you export the orders and where is the discrepancy in dates?
    Can you please give us a specific example?
    Can you please also send us a System Status Report so that we have a better idea of your environment?
    You can get it by navigating to the WooCommerce > Status section of your site. Once there, click on the Get system report button and then copy it by clicking on the Copy for support button. Then paste it in your reply.
    https://d.pr/i/I4WpOa
    Full Image: https://d.pr/i/I4WpOa

Viewing 1 replies (of 1 total)
  • The topic ‘Incorrect date handling when exporting orders (Fix missing orders)’ is closed to new replies.