Exporting different custom field value based on product width
-
Hello,
Thank you for a great plugin.
I have a custom exporting field (custom_field_1).
I want to change its value in exported file to string value ‘DKS’ if at least one of the order’s product has defined width, otherwise set it to string value ‘MKS’.I have this pseudo code, but not sure what is the best way to implement this feature.
add_filter('woe_get_order_value_custom_field_1',function ($value, $order, $fieldname) { $isDKS = false; foreach ($order->get_items() as $item_id => $item_data) { $product = $item_data->get_product(); $product_width = $product->get_width(); if( $product_width ) { $isDKS = true; break; } } if( $isDKS ) { return "DKS"; } else return "MKS"; },10,3);
Hopefully you can help.
Viewing 5 replies - 1 through 5 (of 5 total)
Viewing 5 replies - 1 through 5 (of 5 total)
- The topic ‘Exporting different custom field value based on product width’ is closed to new replies.