• Resolved woowamp

    (@woowamp)


    Hello!
    I am using this plugin to export the order as xlsx but I have an issue. I have custom attribute on all products and export it as a field with “Products” -> “[P] Non variation attributes” but my issue is that it is shown on the xlsx in format “Name” – “Value” of the attribute in the cells. Is there any way to show only the value of the attribute?
    Thank you in advance!

Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Author algol.plus

    (@algolplus)

    Hello

    please, open section “Misc Settings” and add this PHP code.
    thanks, Alex

    add_filter( "woe_get_order_product_value_non_variation_product_attributes", function($field_value, $order,$item, $product, $item_meta ){
    	$attributes = array();
    	foreach ( $product->get_attributes() as $attribute ) {
    		if ( $attribute instanceof WC_Product_Attribute && ! $attribute->get_variation() ) {
    			if ( $attribute->get_taxonomy() ) {
    				$taxObject = $attribute->get_taxonomy_object();
    				if ( isset( $taxObject, $taxObject->attribute_label ) ) {
    					$label = $taxObject->attribute_label;
    				} else {
    					$label = $attribute->get_name();
    				}
    				$attributes[] = join( ",", array_column( $attribute->get_terms(), 'name' ) );
    			} else {
    				$attributes[] =  join( ",", $attribute->get_options() );
    			}
    		}
    	}
    	return join(", ",$attributes);
    },10,5);
    Thread Starter woowamp

    (@woowamp)

    It works fine! Thank you very much!

    Plugin Author algol.plus

    (@algolplus)

    you’re very welcome

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Export only value from custom attributes’ is closed to new replies.