1. I want to seperate column for order id and customer name in vendor login order list and also in excel.
– Add this snippet to your site –
add_filter( 'wcfm_orders_additional_info_column_label', function( $add_label ) {
$add_label = 'Customer';
return $add_label;
});
add_filter( 'wcfm_orders_additonal_data', function( $customer_note, $order_id ) {
global $WCFM, $WCFMmp, $wpdb;
$the_order = wc_get_order( $order_id );
$customer = trim( sprintf( _x( '%1$s %2$s', 'full name', 'wc-frontend-manager' ), $the_order->get_billing_first_name(), $the_order->get_billing_last_name() ) );
return $customer;
}, 50, 2 );
add_filter( 'wcfm_orders_additonal_data_hidden', '__return_false' );
2. or I have a woocommerce booking plugin so can we show person detail(like 1, adult, 1 child) in report.
– DO you want to add “Persons” column to Booking list page? If so, add this snippet to your site –
add_filter( 'wcfm_bookings_additonal_data', function( $content, $booking_id, $order_number ) {
$booking = new WC_Booking( $booking_id );
$product_id = $booking->get_product_id( 'edit' );
$product = $booking->get_product( $product_id );
if ( $product && is_callable( array( $product, 'get_person_types' ) ) ) {
$person_types = $product ? $product->get_person_types() : array();
$person_counts = $booking->get_person_counts();
if ( count( $person_counts ) > 0 || count( $person_types ) > 0 ) {
$content = count( $person_counts );
foreach ( $person_counts as $person_id => $person_count ) {
$person_type = null;
try {
$person_type = new WC_Product_Booking_Person_Type( $person_id );
} catch ( Exception $e ) {
}
if ( $person_type ) {
$content .= '<br />';
$content .= $person_type->get_name() . ' (';
$content .= $person_count;
$content .= ')';
}
}
} else {
$content = ! empty( $person_counts[0] ) ? $person_counts[0] : 0;
}
}
return $content;
}, 50, 3 );
add_filter( 'wcfm_bookings_additional_info_column_label', function( $label ) {
return 'Person(s)';
});
add_filter( 'wcfm_bookings_additonal_data_hidden', '__return_false' );
Add custom code(s) to your child theme’s functions.php
In case you do not have child theme then add those using this plugin –?https://www.ads-software.com/plugins/code-snippets/