Group by Product SKU | WordPress.org

[ad_1]

Hello

I don’t see easy way, it requies some programming. Will you be able to do it ?

I will try. Can provide me with a snippet?

add new key via >Setup Fields>Add Field
fill this key(as array) inside hook with $order->get_id()
add_action( "woe_summary_products_add_item", $key, $product_item, $order, $item ){
},10,4);

rebuild $_SESSION[‘woe_summary_products’] inside hook (repeat product line for each order_id )
add_action( 'woe_summary_before_output' , function(){
});

Its more complicated that i thought. Is it possible describe it with more details?

Thank you.

I will spend same time as I will program it .

So add key “summary_report_order_id”

USe this code

add_action( "woe_summary_products_add_item", function( $key, $product_item, $order, $item ){
$field = "summary_report_order_id";
if( empty( $_SESSION["woe_summary_products"][$key][$field]))
$_SESSION["woe_summary_products"][$key][$field] = array();
$_SESSION["woe_summary_products"][$key][$field][] = $order->get_id();
},10,4);
add_action( 'woe_summary_before_output' , function(){
$new_rows = array();
foreach($_SESSION["woe_summary_products"] as $data) {
foreach($data["summary_report_order_id"] as $idx=>$order_id){
$new_row= $data;
if($idx>0)
foreach($new_row as $k=>$v) $new_row[$k]="";
$new_row["summary_report_order_id"] = $order_id;
$new_rows[] = $new_row;
}
}
$_SESSION["woe_summary_products"] =$new_rows;
});

Works great. Thank you so much

 

This site will teach you how to build a WordPress website for beginners. We will cover everything from installing WordPress to adding pages, posts, and images to your site. You will learn how to customize your site with themes and plugins, as well as how to market your site online.

Buy WordPress Transfer