php - How to implement a filter by shipping method in woocommerce backend? -


I need to apply a filter in the woocommerce backend, which I use to filter the order by the selected shipping method. Can i / P>

I can create a filter on custom fields and change the query, but the problem is that woocommerce stores the shipping method in the DB custom table.

How to get it to filter any signal?

I resolved to add a dropdown menu using this hook:

  add_action ('restrict_manage_posts', 'display_shipping_dropdown');   

And then used this hook to extend this section:

  add_filter ('posts_where', 'admin_shipping_filter', 10, 2) ; Function admin_shipping_filter ($ where, and $ wp_query) {global $ pagenow; $ Method = $ _GET ['shipping_filter']; If (is_admin () and $ pagenow == 'edit.php' & amp; amp; $ wp_query-> query_vars ['post_type'] == 'shop_order' & amp; amp; amp; blank ($ method) {$ $ = $ Global ['wpdb'] - & gt; Ready ('SELECT order_id wp_woocommerce_order_items WHERE order_item_type = "shipping" and order_item_name = "'. $ Method. '' '' '');} $ Where returned;}    

Comments

Popular posts from this blog

java - ImportError: No module named py4j.java_gateway -

python - Receiving "KeyError" after decoding json result from url -

.net - Creating a new Queue Manager and Queue in Websphere MQ (using C#) -