• Resolved hwamart

    (@hwamart)


    add_filter( 'woocommerce_order_number', 'change_woocommerce_order_number' );
    
    function change_woocommerce_order_number( $order_id ) {
        $prefix = 'PYXS/';
        $suffix = '/44';
        $new_order_id = $prefix . $order_id . $suffix;
        return $new_order_id;
    }

    I am using the above snipped to add a prefix and suffix to my order number which seems to work OK however on issue it has created is that the custom code I added to display a tracking code in my order details template now doesn’t work because I assume it still wants the old order id minus the prefix & suffix.

    $tracking_number = get_post_meta($order->get_order_number(), 'linnworks_tracking_number', true);

    Anyone suggest how I can modify this line to work?

    • This topic was modified 5 years, 2 months ago by hwamart.
Viewing 1 replies (of 1 total)
  • Thread Starter hwamart

    (@hwamart)

    I’ve resolved my issue replacing

    $order->get_order_number()

    with

    $order->get_id()

Viewing 1 replies (of 1 total)
  • The topic ‘Custom Order Number’ is closed to new replies.