PluginUs.Net - Business Tools for WooCommerce and WordPress

[realize your idea - make your dreams come true]

Support Forum

You need to log-in to create request (topic) to the support

export : display only products/variation in stock

The support doesn work on Saturdays and Sundays, so some Friday requests can be answered on Monday. If you have problems with registration ask help on contact us page please
If you not got email within 24~36 business hours, firstly check your spam box, and if no any email from the support there - back to the forum and read answer here. DO NOT ANSWER ON EMAILS [noreply@pluginus.net] FROM THE FORUM!! Emails are just for your info, all answers should be published only here.
The support doesn work on Saturdays and Sundays, so some Friday requests can be answered on Monday.
12

Hello,

I  believe you, but after adding your code, the product attributes are once again included in the product name in the order details in WooCommerce.
In my functions.php file, the two codes are arranged like this:

/*  Do not display attributes in the product name in the order details  */

add_filter( 'woocommerce_product_variation_title_include_attributes', '__return_false' );

/*  BEAR BULK display attributes in the product name in CSV */

add_filter('woocommerce_product_variation_title_include_attributes',function($should_include_attributes, $product){
if( wp_doing_ajax() ){
return true;
}
return $should_include_attributes;
},10,2);

What is wrong here ?...
Thanks

Just for testing, try this code:

add_filter('woocommerce_product_variation_title_include_attributes',function($should_include_attributes, $product){

return $should_include_attributes;
},10,2);

Sorry, but with this new code attributes are not included in products titles in .csv file generated by export....

Hello

ok! New code:

add_filter('woocommerce_product_variation_title_include_attributes',function($should_include_attributes, $product){
if( wp_doing_ajax() ){

$action = $_REQUEST['action'] ?? '';

if (strpos($action, 'wpbe') !== false) {
return true;
}

}
return $should_include_attributes;
},10,2);

Hello,
With this new code, attributes are not displayed anymore
in products titles in .csv file generated by export...

add_filter('woocommerce_product_variation_title_include_attributes',function($should_include_attributes, $product){
if( wp_doing_ajax() ){
$action = $_REQUEST['action'] ?? '';
if (strpos($action, 'wpbe') !== false) {
return true;
}
}
return $should_include_attributes;
},10,2);

Thanks

Hello

Great! Welcome;)

You  read so fast : , attributes are not displayed in Bear Bulk export file, it doesn't work  : /

Ok!  Try in  file  - \woo-bulk-editor\classes\models\products.php - change this code - https://share.pluginus.net/image/i20250509132328.png

and  do a test

I modified the code in the \woo-bulk-editor\classes\models\products.php file

/$parent_product = $this->get_product($product->get_parent_id());
$title_base = get_post_field('post_title', $product->get_parent_id());
if (true) {

And I did some tests, with and without the last code, that you had given me before :

 

add_filter('woocommerce_product_variation_title_include_attributes',function($should_include_attributes, $product){
if( wp_doing_ajax() ){
$action = $_REQUEST['action'] ?? '';
if (strpos($action, 'wpbe') !== false) {
return true;
}
}
return $should_include_attributes;
},10,2);

In both cases it doesn't work : still no attributes in the product title in the .csv

Hello

oK! So our plugin doesn't affect this, because this is the only place where our plugin can affect the display format of titles.

For this reason my code could not change it

Hello Pablo,

It's been a while...
I'm getting back to you because the developers of the serial/batch number module provided me with the code to include the serial numbers of product variations in the .csv export file...

Here's the code:

function wpo_add_batch_number_to_bear_bulk_exported_data( array $answer, int $product_id, array $fields ): array {
foreach ( $fields as $field_key => $field ) {
if (
! empty( $field['field_type'] ) &&
'meta' === $field['field_type'] &&
'product_batch_numbers' === $field['meta_key'] ) {
// find field_key position in array
$field_key_pos = array_search( $field_key, array_keys( $fields ) ) - 1;
}
}


if ( ! empty( $field_key_pos ) && array_key_exists( $field_key_pos, $answer ) ) {
$ids = array();

$product = wc_get_product( $product_id );
if ( empty( $product ) ) {
return $answer;
}

$ids[] = $product->get_id();

$variation_ids = $product->get_children();
if ( ! empty( $variation_ids ) ) {
foreach ( $variation_ids as $variation_id ) {
$variation = wc_get_product( $variation_id );
if ( empty( $variation ) ) {
continue;
}
$ids[] = $variation_id;
}
}

$args = array(
'shared_ids' => $ids,
'status' => 'active',
'order_by' => WPO_WCPBN()->classes['settings']->options->get_option( 'batch_prioritization' ) ? WPO_WCPBN()->classes['settings']->options->get_option( 'batch_prioritization' ) : 'id',
'order' => 'ASC',
);

$batches = wpo_wcpbn_get_batches( $args );
$batches_data = array();

foreach ( $batches as $batch ) {
$batches_data[] = $batch->batch_number . ' (' . absint( $batch->quantity_available ) . ')';
}

$answer[ $field_key_pos ] = implode( ' - ', $batches_data );
}

return $answer;
}

add_filter( 'woobe_export_product_fields_answer', 'wpo_add_batch_number_to_bear_bulk_exported_data', 10, 3 );

Export csv screenshot here :
https://ibb.co/w2Wvkbx

Could you adapt it so that all product variations attributes be exported in .csv ?
That would be great !
Thanks

Hello

I'll pass this on to the developers so they can check it out.

12