Woocommerce get product quantity on my backoffice orders
-
Hello,
I want to add a new column in my woocommerce orders and display the quantity of the products sold.
For example:Name Products Quantity
blue tshirt 2
James red tshirt 1
yellow tshirt 1I have this but is not working 100%
add_filter( ‘manage_edit-shop_order_columns’, ‘admin_orders_list_add_column’, 10, 1 );
function admin_orders_list_add_column( $columns ){
$columns[‘custom_column2’] = __( ‘Quantidade’, ‘woocommerce’ );return $columns;
}add_action( ‘manage_shop_order_posts_custom_column’ , ‘admin_orders_list_column_content’, 10, 2 );
function admin_orders_list_column_content( $column, $post_id ){
global $post;if ( ‘custom_column2’ === $column ) {
$order = wc_get_order( $post->ID );
echo ‘Qty: ‘ . $order->get_items() . ‘
‘;
//echo ‘× ‘ . $order->get_quantity();
}
} -
Hi there,
Please contact WooCommerce support directly for help with their plugin. The forum you’re posting in now is for the hosting provider, WordPress.com, and we can only help with sites that are hosted on our servers.
If you’re using the free version of WooCommerce you can post in their community forum, here:
https://wordpress.org/support/plugin/woocommerce/
Or if you’re using any premium or payment gateway add-on downloaded from WooCommerce.com you can reach live chat and email support here:
- The topic ‘Woocommerce get product quantity on my backoffice orders’ is closed to new replies.