• Cayce

    (@codeparachute)


    Hello, thanks for the great plugin!

    I am working with a client that wants to programmatically change the customer_reference when an order is created.

    I modified sendle-shipment-booking.php @ line 286 to add:

    //Allow plugins & themes to change the customer reference.
    //Reference will appear on the label for parcel identification. It must be under 255 characters in length. (Optional)
    //https://api-doc.sendle.com/#parcel-details
    $customer_reference = apply_filters('ossm_filter_customer_reference', $order_id);
    if ($customer_reference && strlen($customer_reference) >= 255) $customer_reference = $order_id;
    ossm_logActions("[orderid:".$order_id."] ossm_filter_customer_reference Customer Reference : ".$customer_reference." ");

    And below that in the $json variable to include

    "customer_reference": "'.$customer_reference.'",

    In a different plugin, I am doing the following:

    
    function codeparachute_filter_customer_reference($order_id) {
        $order = wc_get_order($order_id);
        return $order->get_name();
    }
    add_filter('ossm_filter_customer_reference', 'codeparachute_filter_customer_reference');
    

    Questions for the maintainer:

    1. Is this the appropriate way to modify the customer reference?
    2. Can this filter be added to the plugin?

Viewing 1 replies (of 1 total)
  • Plugin Author Joovii

    (@joovii)

    Hi,
    I have added ossm_filter_customer_reference filter to the plugin.
    Please let me know it is working or not.

    Thanks

Viewing 1 replies (of 1 total)
  • The topic ‘Add filter for customer reference’ is closed to new replies.