0

I was wondering if there is a way to add the shipping class in the admin order overview in the shipping column? It is displaying the Shipping Adress but I also need the Shipping Class here because I need to know how I ship the order. I dont want to go into every single order to find out what shipping class was calculated.

Can you help me?

0

With a short Google, I was able to quickly find a solution. Please see this link to find other order item information that you could also use!

This link is where I found the original code and edited to suit the OP's requirements.

function anakeme_columns_shipping_class( $columns ) {

    $columns['shipping_class'] = 'Shipping Class';
    return $columns;

}
add_filter( 'manage_edit-shop_order_columns', 'anakeme_columns_shipping_class' );

    
function anakeme_columns_shipping_class_content( $column ) {
    
    global $post;
    
    if ( 'shipping_class' === $column ) {
    
        $order = wc_get_order( $post->ID );
        echo $order->get_shipping_method();
        
    }
}
add_action( 'manage_shop_order_posts_custom_column', 'anakeme_columns_shipping_class_content' );
2
  • Hey! Thanks for your help! It worked :) – Jacqui Apr 23 at 7:52
  • No worries! Please be sure to mark the answer as correct :) Happy coding! – Anake.me Apr 23 at 11:27

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.