Skip to content
Advertisement

Add a sortable custom column in Woocommerce Admin Orders list

I’ve added a custom column to the “Orders” section of WooCommerce for the shipping zip code. The column and its values appear correctly.

What I cannot figure out is how to make the sorting of this field work (clicking on the column header). Other code examples I could find mention using the hook “manage_edit-shop_order_sortable_columns”, but this doesn’t seem to be working for this field.

Note: I’ve seen the other StackOverflow issues about this, but none seem to have sorting working.

JavaScript

Advertisement

Answer

I figured it out. Will leave this up here for anyone else trying to add a sorted zip code column. Just add this additional action.

JavaScript
User contributions licensed under: CC BY-SA
9 People found this is helpful
Advertisement