Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Submitting a valid tracking instead of a plain shipAll() #425

Open
NulSEO opened this issue Oct 3, 2020 · 2 comments · May be fixed by Kimmax/Mollie-Woocommerce#1 or #863
Open

Submitting a valid tracking instead of a plain shipAll() #425

NulSEO opened this issue Oct 3, 2020 · 2 comments · May be fixed by Kimmax/Mollie-Woocommerce#1 or #863

Comments

@NulSEO
Copy link

NulSEO commented Oct 3, 2020

Hi guys,

I'm a little confused. Klarnas ToS clearly say that you're obligated to submit a valid tracking - the official plugin however doesn't seem to care about that really (for whatever reason ;-))

There are multiple fulfillment plugins, but the majority of the people is using https://woocommerce.com/products/shipment-tracking/ - Supporting this plugin is pretty necessary I believe, especially for people that sell a lot through Klarna.

Adding support for this plugin is incredibly simple, I'm not sure why this hasn't been done yet.

Mollie/WC/Plugin.php (shipAndCaptureOrderAtMollie()):

// [...]
if ($mollie_order->isPaid() || $mollie_order->isAuthorized()) {
    $trackingInfo = get_post_meta($order->id, '_wc_shipment_tracking_items', true);

    if (empty($trackingInfo)) {
        Mollie_WC_Plugin::getApiHelper()->getApiClient($test_mode)->orders->get($mollie_order_id)->shipAll();
        $order->add_order_note('Order successfully updated to shipped at Mollie, capture of funds underway.');
        Mollie_WC_Plugin::debug(__METHOD__ . ' - ' . $order_id . ' - Order successfully updated to shipped at Mollie, capture of funds underway.');
        return;
    }

    $trackingInfo = (object)$trackingInfo[0];
    $carrierName = !empty($trackingInfo->tracking_provider) ? $trackingInfo->tracking_provider : $trackingInfo->custom_tracking_provider;
    if (empty($carrierName)) {
        Mollie_WC_Plugin::getApiHelper()->getApiClient($test_mode)->orders->get($mollie_order_id)->shipAll();
        $order->add_order_note("Fulfillment doesn't seem to have a tracking tracking number. Fulfilling order without tracking info.");
        return;
    }

    if (empty($trackingInfo->tracking_number)) {
        Mollie_WC_Plugin::getApiHelper()->getApiClient($test_mode)->orders->get($mollie_order_id)->shipAll();
        $order->add_order_note("Fulfillment doesn't seem to have a tracking tracking number. Fulfilling order without tracking info.");
        return;
    }

    $trackingLink = !empty($trackingInfo->tracking_link) ? $trackingInfo->tracking_link : $trackingInfo->custom_tracking_link;
    if (empty($trackingLink)) {
        Mollie_WC_Plugin::getApiHelper()->getApiClient($test_mode)->orders->get($mollie_order_id)->shipAll();
        $order->add_order_note("Fulfillment doesn't seem to have a tracking link. Fulfilling order without tracking info.");
        return;
    }

    $tracking = [];
    $tracking['tracking'] = [
        'carrier' => $carrierName,
        'code' => $trackingInfo->tracking_number,
        'url' => $trackingLink
    ];
    Mollie_WC_Plugin::getApiHelper()->getApiClient($test_mode)->orders->get($mollie_order_id)->shipAll($tracking);
    // [...]
}
@oleohlen
Copy link

Any new information here ? How could I import the trackingnumbers from any order to mollie ?

@Kimmax
Copy link

Kimmax commented Nov 21, 2023

Hi!

I can understand if Mollie doesn't want to support different shipment plugins, but a simple hook to provide a value for shipAll() should be easy enough? That way support can be added externally without hacking the plugin code every time.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
4 participants