• Resolved indrek_k

    (@indrek_k)


    Hi there!

    I’d like to implement the functionality to send the tracking code to the customers via email. However, from what I can see, the only way to generate the tracking code currently is manually via order actions. I checked the code base and the functionality to generate the tracking code is hard coupled to printing it: Dpd_Baltic_Admin->order_shipment_creation() is a private function and in addition to that, the functionality to actually contact the API is inside the print_order_parcel_label() function.

    Is there a way to generate the tracking code without printing that I’m currently not seeing? If not, could you possibly modify the plugin code and provide a simple public API to get the order tracking number?

    Thanks!

Viewing 7 replies - 1 through 7 (of 7 total)
  • seik.eu

    (@rudolfgustav)

    I found a simple solution to send the tracking codes.

    When generating the parcel labels, plugin saves a comment to the order. With easy change you can make this comment to be sent to the customer.

    In plugin files open following file:
    woo-shipping-dpd-baltic/admin/class-dpd-admin.php

    Search for:

    $message = sprintf( __( 'DPD Tracking number: %s', 'woo-shipping-dpd-baltic' ), $barcode );
    			$order->add_order_note( $message, false, true );
    		}
    

    And change it to:

    $message = sprintf( __( 'DPD Tracking number: https://tracking.dpd.de/status/en_US/parcel/%s', 'woo-shipping-dpd-baltic' ), $barcode );
    			$order->add_order_note( $message, true, true );
    		}
    

    add_order_note after $message the value defines if the message is visible only for admins or also sent to the customers. Customers get then email that there has been a message added to the order.

    You can also add some more text to this message.

    Note, that DPD tracking shows the status after it has been scanned by DPD
    Until that it gives error, that this shortcode doesn’t exist.
    For our store we added text like:

    $message = sprintf( __( 'We have generated the DPD label and are packaging your order. DPD Tracking number: https://tracking.dpd.de/status/en_US/parcel/%s Delivery status is visible after DPD has picked parcel up, it may take a bit time', 'woo-shipping-dpd-baltic' ), $barcode );
    			$order->add_order_note( $message, true, true );
    		}
    

    Hope it helps. I guess for a more advanced solution you can ask DPD customer service directly.

    • This reply was modified 3 years, 7 months ago by seik.eu.
    Thread Starter indrek_k

    (@indrek_k)

    This is actually a pretty good solution, thanks. I wouldn’t want to modify the plugin code, but perhaps the devs could make a simple change to the code base that would allow us to utilize this? For example, adding a filter around the 2nd param of add_order_note(). That way it could still default to false, but we’d have a way to change it.

    Plugin Author dpdbaltics

    (@dpdbaltics)

    Hello, @indrek_k ,

    We will take this change into consideration, but for now we don’t have any plans for this this.

    If you need more advanced help from developers, contact us at: [email protected].
    For now I’m marking this issue resolved ??

    Thread Starter indrek_k

    (@indrek_k)

    Uhh, this is a very very tiny change, perhaps you could consider implementing it? It doesn’t change anything for other users, but just enables your plugin users to add functionality for sending tracking codes to customers. All the other shipping plugins we are using already provide this functionality.

    My final proposition would be adding an action after the order note is created.
    After woo-shipping-dpd-baltic/admin/class-dpd-admin.php line 520:

    do_action('woo_shipping_dpd_baltic/tracking_code', $barcode->dpd_barcode);

    Thanks!

    • This reply was modified 3 years, 7 months ago by indrek_k.
    Thread Starter indrek_k

    (@indrek_k)

    Hi @dpdbaltics

    Any update on this?

    We forked the plugin to add support to send tracking code in a email.

    https://github.com/codelight-eu/WooCommerce-Shipping-DPD-baltic

    Would appreciate if you do decide to add this in the plugin – then we can stop maintaining the fork ??

    Plugin Author dpdbaltics

    (@dpdbaltics)

    Hello, @toktor ,

    Thank you for you help ?? . We will try to add this functionality in upcoming updates.

    We will notify you about newest changes about this integration through email or plugin patch notes.

Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘Sending tracking code to customer via email’ is closed to new replies.