Make default value
-
Hello,
Is there a way to define default value to a field if this field is empty for some command but have a value for the other command.
Because I have some digital product so i don’t have a value for like the shipping information, but I still need a value in my export ?
-
Hello
can you share your settings?
visit tab Tools to get them
i will look for them but the thing i need i think is something like this
add_filter(‘woe_get_order_value_shipping_first_name’,function( $value,$order, $fieldname ) {
if (is_null($value)) {
$value = “-“;
}
return $value;
}, 10, 3 );
But i’m not sure of this function “woe_get_order_value_shipping”
{ "now": { "version": "2.0", "mode": "now", "title": "", "skip_empty_file": true, "log_results": false, "from_status": [], "to_status": [], "change_order_status_to": "", "statuses": [ "wc-processing" ], "from_date": "2023-12-01", "to_date": "2024-02-01", "sub_start_from_date": "", "sub_start_to_date": "", "sub_end_from_date": "", "sub_end_to_date": "", "sub_next_paym_from_date": "", "sub_next_paym_to_date": "", "from_order_id": "", "to_order_id": "", "shipping_locations": [], "shipping_methods": [], "item_names": [], "item_metadata": [], "user_roles": [], "user_names": [], "user_custom_fields": [], "billing_locations": [], "payment_methods": [], "any_coupon_used": "0", "coupons": [], "order_custom_fields": [], "product_categories": [], "product_vendors": [], "products": [], "product_sku": "", "exclude_products": [], "product_taxonomies": [], "product_custom_fields": [], "product_attributes": [], "product_itemmeta": [], "format": "CSV", "format_xls_use_xls_format": "0", "format_xls_sheet_name": "Orders", "format_xls_display_column_names": "1", "format_xls_auto_width": "1", "format_xls_direction_rtl": "0", "format_xls_force_general_format": "0", "format_xls_remove_emojis": "0", "format_xls_row_images_width": "50", "format_xls_row_images_height": "50", "format_csv_enclosure": "\"", "format_csv_delimiter": ";", "format_csv_linebreak": "\\r\\n", "format_csv_display_column_names": "1", "format_csv_add_utf8_bom": "1", "format_csv_item_rows_start_from_new_line": "1", "format_csv_encoding": "UTF-8", "format_csv_delete_linebreaks": "0", "format_csv_remove_linebreaks": "0", "format_csv_force_quotes": "0", "format_tsv_linebreak": "\\r\\n", "format_tsv_display_column_names": "1", "format_tsv_add_utf8_bom": "0", "format_tsv_item_rows_start_from_new_line": "0", "format_tsv_encoding": "UTF-8", "format_xml_root_tag": "Orders", "format_xml_order_tag": "Order", "format_xml_product_tag": "Product", "format_xml_coupon_tag": "Coupon", "format_xml_prepend_raw_xml": "", "format_xml_append_raw_xml": "", "format_xml_self_closing_tags": "1", "format_xml_preview_format": "0", "format_json_start_tag": "[", "format_json_end_tag": "]", "format_json_unescaped_slashes": 0, "format_json_numeric_check": 0, "format_json_encode_unicode": 0, "format_pdf_display_column_names": "1", "format_pdf_repeat_header": "1", "format_pdf_direction_rtl": 0, "format_pdf_orientation": "L", "format_pdf_page_size": "A4", "format_pdf_font_size": "8", "format_pdf_header_text": "", "format_pdf_footer_text": "", "format_pdf_pagination": "C", "format_pdf_fit_page_width": "0", "format_pdf_cols_width": "25", "format_pdf_cols_align": "L", "format_pdf_cols_vertical_align": "T", "format_pdf_page_header_text_color": "#000000", "format_pdf_page_footer_text_color": "#000000", "format_pdf_table_header_text_color": "#000000", "format_pdf_table_header_background_color": "#FFFFFF", "format_pdf_table_row_text_color": "#000000", "format_pdf_table_row_background_color": "#FFFFFF", "format_pdf_logo_source_id": "0", "format_pdf_logo_source": "", "format_pdf_logo_width": "0", "format_pdf_logo_height": "15", "format_pdf_logo_align": "R", "format_pdf_row_images_width": "15", "format_pdf_row_images_height": "15", "format_pdf_row_images_add_link": "0", "format_pdf_row_dont_page_break_order_lines": "0", "format_html_display_column_names": "1", "format_html_repeat_header_last_line": "0", "format_html_font_size": "13", "format_html_header_text": "", "format_html_footer_text": "", "format_html_cols_align": "L", "format_html_header_text_color": "#000000", "format_html_footer_text_color": "#000000", "format_html_table_header_text_color": "#000000", "format_html_table_header_background_color": "#FFFFFF", "format_html_table_row_text_color": "#000000", "format_html_table_row_background_color": "#FFFFFF", "format_html_row_images_width": "100", "format_html_row_images_height": "100", "format_html_images_add_link": "0", "format_html_custom_css": "", "all_products_from_order": "1", "skip_refunded_items": "0", "skip_suborders": "0", "export_refunds": "0", "export_matched_items": "0", "date_format": "Y-m-d", "time_format": "H:i:s", "sort_direction": "DESC", "sort": "order_id", "format_number_fields": "0", "export_all_comments": "0", "export_refund_notes": "0", "strip_tags_product_fields": "0", "strip_html_tags": "0", "round_item_tax_rate": "0", "cleanup_phone": "0", "convert_serialized_values": "0", "enable_debug": "0", "billing_details_for_shipping": "0", "custom_php": "1", "custom_php_code": "add_filter(\u0027woe_get_order_value__shipping_method_chronorelais\u0027,function( $value,$order, $fieldname ) {\r\n$data = maybe_unserialize($value);\r\nif(is_array($data)) $value = $data[\"id\"];\r\nreturn $value;\r\n}, 10, 3 );\r\n\r\n\/\/ only 1st tax rate will be exported\r\nadd_filter(\u0027woe_get_order_product_value_tax_percentage\u0027, function ($value, $order, $item, $product,$item_meta) {\r\n$taxes = $item->get_taxes();\r\nif ( empty($taxes[\u0027subtotal\u0027]) ) return 0;\r\nforeach($taxes[\u0027subtotal\u0027] as $tax_rate_id =>$amount) {\r\n$tax_percent = WC_Tax::get_rate_percent( $tax_rate_id );\r\n$tax_rate = str_replace(\u0027%\u0027, \u0027\u0027, $tax_percent); \/\/remove extra %\r\nreturn $tax_rate;\r\n}\r\nreturn 0;\r\n}, 10, 5);\r\n\r\nadd_filter(\u0027woe_get_order_product_value_item_coupon\u0027, function ($value, $order, $item, $product, $item_meta) {\r\n\r\n\t\/\/il faut comprendre qu\u0027un coupon est associ\u00e9 \u00e0 une commande, et pas \u00e0 une ligne \/ un produit de la commande\r\n\t\/\/alors que l\u00e0, on veut la remise qui est appliqu\u00e9e sur un produit\r\n\t\/\/on va donc parcourir les coupons et d\u00e9terminer si l\u0027un s\u0027applique au produit courant\r\n\tforeach ($order->get_coupon_codes() as $coupon_code) {\r\n\t\t$coupon = new WC_Coupon($coupon_code);\r\n\r\n\t\t\/\/on commence par s\u0027assurer qu\u0027il s\u0027agit d\u0027un remise en pourcentage : tout autre coupon est ignor\u00e9\r\n\t\tif ($coupon->get_discount_type() == \"percent\") {\r\n\t\t\t\/\/ensuite on regarde si le coupon s\u0027applique \u00e0 un produit en particulier ou \u00e0 tout le panier\r\n\t\t\t\/\/la r\u00e8gle d\u00e9finie ensemble est que si la liste de produits sur lesquels le coupon est application est vide, alors il s\u0027applique \u00e0 tous les produits du panier\r\n\t\t\t$product_ids=$coupon->get_product_ids();\r\n\t\t\tif (empty($product_ids)) {\r\n\t\t\t\treturn $coupon->get_amount();\r\n\t\t\t}\r\n\t\t\t\r\n\t\t\t\/\/sinon, on regarde sur quels produits le coupon est applicable\r\n\t\t\t\/\/si le produit courant en fait partie, on y applique le coupon\r\n\t\t\tif (in_array($product->get_id(), $product_ids)) {\r\n\t\t\t\treturn $coupon->get_amount();\r\n\t\t\t}\r\n\r\n\t\t\t\/\/si on arrive ici, c\u0027est donc que le coupon courant n\u0027est pas applicable au produit courant\r\n\t\t}\r\n\t}\r\n\t\/\/si on arrive ici, c\u0027est qu\u0027aucun coupon valide pour ce produit n\u0027a \u00e9t\u00e9 identifi\u00e9\r\n\t\/\/inversement \/ effet de bord : si plusieurs coupons sont applicables pour ce produit, on renvoie le premier trouv\u00e9 sans chercher plus loin\r\n\treturn 0;\r\n\r\n}, 10, 5);", "mark_exported_orders": "0", "export_unmarked_orders": "0", "summary_report_by_products": "0", "duplicated_fields_settings": { "products": { "repeat": "rows", "populate_other_columns": "1", "max_cols": "10", "group_by": "product", "line_delimiter": "\\n" }, "coupons": { "repeat": "rows", "max_cols": "10", "group_by": "product", "line_delimiter": "\\n" } }, "summary_report_by_customers": "0", "order_fields": [ { "segment": "common", "key": "static_field_2", "label": "Identifiant de ligne", "format": "string", "colname": "Identifiant de ligne", "value": "E" }, { "segment": "common", "key": "order_number", "label": "Order Number", "format": "string", "colname": "Order Number" }, { "segment": "common", "key": "static_field_6", "label": "Code site web", "format": "number", "colname": "Code site web", "value": "1" }, { "segment": "user", "key": "user_email", "label": "Customer User Email", "format": "string", "colname": "Customer User Email" }, { "segment": "user", "key": "customer_user", "label": "Customer User ID", "format": "number", "colname": "Customer User ID" }, { "segment": "common", "key": "order_date", "label": "Order Date", "format": "date", "colname": "Order Date" }, { "segment": "common", "key": "static_field_5", "label": "Edition TTC", "format": "", "colname": "Edition TTC", "value": "0" }, { "segment": "ship_calc", "key": "shipping_method_title", "label": "Shipping Method Title", "format": "string", "colname": "Shipping Method Title" }, { "segment": "common", "key": "static_field_11", "label": "Commentaire imprimable de fin", "format": "string", "colname": "Commentaire imprimable de fin", "value": "" }, { "segment": "common", "key": "static_field_9", "label": "Commentaire non imprimable", "format": "string", "colname": "Commentaire non imprimable", "value": "Paiement CB" }, { "segment": "ship_calc", "key": "order_shipping", "label": "Order Shipping Amount", "format": "money", "colname": "Order Shipping Amount" }, { "segment": "billing", "key": "static_field_3", "label": "Taux TVA Frais de port", "format": "number", "colname": "Taux TVA Frais de port", "value": "20" }, { "segment": "common", "key": "static_field_12", "label": "Remise sur frais de port en %", "format": "number", "colname": "Remise sur frais de port en %", "value": "0.00" }, { "segment": "common", "key": "static_field_13", "label": "Montant de remise sur frais de port (prioritaire sur %)", "format": "number", "colname": "Montant de remise sur frais de port (prioritaire sur %)", "value": "0.00" }, { "segment": "common", "key": "static_field_14", "label": "Remise sur articles en %", "format": "number", "colname": "Remise sur articles en %", "value": "0.00" }, { "segment": "common", "key": "static_field_15", "label": "Montant de remise sur articles (prioritaire sur %)", "format": "number", "colname": "Montant de remise sur articles (prioritaire sur %)", "value": "0.00" }, { "segment": "common", "key": "static_field_10", "label": "Mode de reglement", "format": "string", "colname": "Mode de reglement", "value": "Carte bancaire avec SIPS\/" }, { "segment": "common", "key": "static_field_16", "label": "Num\u00e9ro de TVA intracommunautaire", "format": "string", "colname": "Num\u00e9ro de TVA intracommunautaire", "value": "" }, { "segment": "common", "key": "plain_orders_gender_billing", "label": "gender_billing", "format": "", "colname": "gender_billing" }, { "segment": "billing", "key": "billing_last_name", "label": "Last Name (Billing)", "format": "string", "colname": "Last Name (Billing)" }, { "segment": "billing", "key": "billing_first_name", "label": "First Name (Billing)", "format": "string", "colname": "First Name (Billing)" }, { "segment": "billing", "key": "billing_company", "label": "Company (Billing)", "format": "string", "colname": "Company (Billing)" }, { "segment": "billing", "key": "billing_address_1", "label": "Address 1 (Billing)", "format": "string", "colname": "Address 1 (Billing)" }, { "segment": "billing", "key": "billing_address_2", "label": "Address 2 (Billing)", "format": "string", "colname": "Address 2 (Billing)" }, { "segment": "common", "key": "static_field_17", "label": "Ligne adresse 3 facturation", "format": "string", "colname": "Ligne adresse 3 facturation", "value": "" }, { "segment": "billing", "key": "billing_postcode", "label": "Postcode (Billing)", "format": "string", "colname": "Postcode (Billing)" }, { "segment": "billing", "key": "billing_city", "label": "City (Billing)", "format": "string", "colname": "City (Billing)" }, { "segment": "billing", "key": "billing_country", "label": "Country Code (Billing)", "format": "string", "colname": "Country Code (Billing)" }, { "segment": "billing", "key": "billing_phone", "label": "Phone (Billing)", "format": "string", "colname": "Phone (Billing)" }, { "segment": "common", "key": "static_field_18", "label": "Fax facturation", "format": "string", "colname": "Fax facturation", "value": "" }, { "segment": "billing", "key": "billing_email", "label": "Email (Billing)", "format": "string", "colname": "Email (Billing)" }, { "segment": "common", "key": "plain_orders_gender_shipping", "label": "gender_shipping", "format": "", "colname": "gender_shipping" }, { "segment": "shipping", "key": "shipping_last_name", "label": "Last Name (Shipping)", "format": "string", "colname": "Last Name (Shipping)" }, { "segment": "shipping", "key": "shipping_first_name", "label": "First Name (Shipping)", "format": "string", "colname": "First Name (Shipping)" }, { "segment": "shipping", "key": "shipping_company", "label": "Company (Shipping)", "format": "string", "colname": "Company (Shipping)" }, { "segment": "shipping", "key": "shipping_address_1", "label": "Address 1 (Shipping)", "format": "string", "colname": "Address 1 (Shipping)" }, { "segment": "shipping", "key": "shipping_address_2", "label": "Address 2 (Shipping)", "format": "string", "colname": "Address 2 (Shipping)" }, { "segment": "common", "key": "static_field_19", "label": "Ligne adresse 3 livraison", "format": "string", "colname": "Ligne adresse 3 livraison", "value": "" }, { "segment": "shipping", "key": "shipping_postcode", "label": "Postcode (Shipping)", "format": "string", "colname": "Postcode (Shipping)" }, { "segment": "shipping", "key": "shipping_city", "label": "City (Shipping)", "format": "string", "colname": "City (Shipping)" }, { "segment": "shipping", "key": "shipping_country", "label": "Country Code (Shipping)", "format": "string", "colname": "Country Code (Shipping)" }, { "segment": "common", "key": "static_field_20", "label": "T\u00e9l\u00e9phone livraison", "format": "string", "colname": "T\u00e9l\u00e9phone livraison", "value": "" }, { "segment": "common", "key": "static_field_21", "label": "Fax livraison", "format": "string", "colname": "Fax livraison", "value": "" }, { "segment": "common", "key": "static_field_22", "label": "E-mail livraison", "format": "string", "colname": "E-mail livraison", "value": "" }, { "segment": "ship_calc", "key": "plain_orders__shipping_method_chronorelais", "label": "_shipping_method_chronorelais", "format": "string", "colname": "_shipping_method_chronorelais" }, { "segment": "common", "key": "customer_note", "label": "Customer Note", "format": "string", "colname": "Customer Note" }, { "segment": "shipping", "key": "static_field_23", "label": "Envoi partiel de la commande", "format": "number", "colname": "Envoi partiel de la commande", "value": "" }, { "segment": "shipping", "key": "static_field_24", "label": "Paquet cadeau", "format": "", "colname": "Paquet cadeau", "value": "" }, { "segment": "shipping", "key": "static_field_25", "label": "Bloquer la commande", "format": "", "colname": "Bloquer la commande", "value": "" }, { "segment": "shipping", "key": "static_field_26", "label": "Valider la commande", "format": "", "colname": "Valider la commande", "value": "" }, { "segment": "shipping", "key": "static_field_27", "label": "Origine de la commande", "format": "", "colname": "Origine de la commande", "value": "" }, { "segment": "shipping", "key": "static_field_28", "label": "Informations sur la commande", "format": "", "colname": "Informations sur la commande", "value": "" }, { "segment": "shipping", "key": "static_field_29", "label": "Taux indicatif de change \u20ac \u2194 \u00a3", "format": "number", "colname": "Taux indicatif de change \u20ac \u2194 \u00a3", "value": "" }, { "segment": "shipping", "key": "static_field_30", "label": "Login du responsable", "format": "string", "colname": "Login du responsable", "value": "" }, { "segment": "shipping", "key": "static_field_31", "label": "Date de livraison pr\u00e9vue", "format": "date", "colname": "Date de livraison pr\u00e9vue", "value": "" }, { "segment": "shipping", "key": "static_field_32", "label": "R\u00e9f. commande de la market place", "format": "string", "colname": "R\u00e9f. commande de la market place", "value": "" }, { "segment": "shipping", "key": "static_field_33", "label": "R\u00e9f. commande", "format": "string", "colname": "R\u00e9f. commande", "value": "" }, { "segment": "products", "key": "products", "colname": "Products", "label": "Products", "format": "undefined" }, { "segment": "products", "key": "plain_products_static_field_2", "label": "Identifiant de ligne", "format": "", "colname": "Identifiant de ligne", "value": "L" }, { "segment": "products", "key": "plain_products_sku", "label": "SKU", "format": "string", "colname": "R\u00e9f\u00e9rence article" }, { "segment": "products", "key": "plain_products_name", "label": "Item Name", "format": "string", "colname": "Item Name" }, { "segment": "products", "key": "plain_products_qty_minus_refund", "label": "Quantity (- Refund)", "format": "number", "colname": "Quantity (- Refund)" }, { "segment": "products", "key": "plain_products_item_price_before_discount", "label": "Item Cost Before Discount", "format": "money", "colname": "Item Cost Before Discount" }, { "segment": "products", "key": "plain_products_item_coupon", "label": "item_coupon", "format": "money", "colname": "Coupon Amount" }, { "segment": "coupons", "key": "coupons", "colname": "Coupons", "label": "Coupons", "format": "undefined" }, { "segment": "products", "key": "plain_products_tax_percentage", "label": "tax_percentage", "format": "number", "colname": "tax_percentage" }, { "segment": "products", "key": "plain_products_static_field_3", "label": "Commentaire avant article", "format": "", "colname": "Commentaire avant article", "value": "" }, { "segment": "products", "key": "plain_products_static_field_4", "label": "Commentaire avant article", "format": "", "colname": "Commentaire avant article", "value": "" }, { "segment": "products", "key": "plain_products_static_field_5", "label": "Commentaire avant article", "format": "", "colname": "Commentaire avant article", "value": "" } ], "order_product_fields": [ { "label": "SKU", "format": "string", "colname": "SKU", "default": 1, "key": "sku" }, { "label": "Item #", "format": "number", "colname": "Item #", "default": 1, "key": "line_id" }, { "label": "Item Name", "format": "string", "colname": "Item Name", "default": 1, "key": "name" }, { "label": "Quantity (- Refund)", "format": "number", "colname": "Quantity (- Refund)", "default": 1, "key": "qty_minus_refund" }, { "label": "Item Cost", "format": "money", "colname": "Item Cost", "default": 1, "key": "item_price" } ], "order_coupon_fields": [ { "label": "Coupon Code", "format": "string", "colname": "Coupon Code", "default": 1, "key": "code" }, { "label": "Discount Amount", "format": "money", "colname": "Discount Amount", "default": 1, "key": "discount_amount" }, { "label": "Discount Amount Tax", "format": "money", "colname": "Discount Amount Tax", "default": 1, "key": "discount_amount_tax" } ], "id": 0, "post_type": "shop_order", "export_rule_field": "date", "export_filename": "orders-%y-%m-%d-%h-%i-%s.csv", "summary_row_title": "Total" }, "profiles": [], "cron": [], "order-action": [] }{ "now": { "version": "2.0", "mode": "now", "title": "", "skip_empty_file": true, "log_results": false, "from_status": [], "to_status": [], "change_order_status_to": "", "statuses": [ "wc-processing" ], "from_date": "2023-12-01", "to_date": "2024-02-01", "sub_start_from_date": "", "sub_start_to_date": "", "sub_end_from_date": "", "sub_end_to_date": "", "sub_next_paym_from_date": "", "sub_next_paym_to_date": "", "from_order_id": "", "to_order_id": "", "shipping_locations": [], "shipping_methods": [], "item_names": [], "item_metadata": [], "user_roles": [], "user_names": [], "user_custom_fields": [], "billing_locations": [], "payment_methods": [], "any_coupon_used": "0", "coupons": [], "order_custom_fields": [], "product_categories": [], "product_vendors": [], "products": [], "product_sku": "", "exclude_products": [], "product_taxonomies": [], "product_custom_fields": [], "product_attributes": [], "product_itemmeta": [], "format": "CSV", "format_xls_use_xls_format": "0", "format_xls_sheet_name": "Orders", "format_xls_display_column_names": "1", "format_xls_auto_width": "1", "format_xls_direction_rtl": "0", "format_xls_force_general_format": "0", "format_xls_remove_emojis": "0", "format_xls_row_images_width": "50", "format_xls_row_images_height": "50", "format_csv_enclosure": "\"", "format_csv_delimiter": ";", "format_csv_linebreak": "\r\n", "format_csv_display_column_names": "1", "format_csv_add_utf8_bom": "1", "format_csv_item_rows_start_from_new_line": "1", "format_csv_encoding": "UTF-8", "format_csv_delete_linebreaks": "0", "format_csv_remove_linebreaks": "0", "format_csv_force_quotes": "0", "format_tsv_linebreak": "\r\n", "format_tsv_display_column_names": "1", "format_tsv_add_utf8_bom": "0", "format_tsv_item_rows_start_from_new_line": "0", "format_tsv_encoding": "UTF-8", "format_xml_root_tag": "Orders", "format_xml_order_tag": "Order", "format_xml_product_tag": "Product", "format_xml_coupon_tag": "Coupon", "format_xml_prepend_raw_xml": "", "format_xml_append_raw_xml": "", "format_xml_self_closing_tags": "1", "format_xml_preview_format": "0", "format_json_start_tag": "[", "format_json_end_tag": "]", "format_json_unescaped_slashes": 0, "format_json_numeric_check": 0, "format_json_encode_unicode": 0, "format_pdf_display_column_names": "1", "format_pdf_repeat_header": "1", "format_pdf_direction_rtl": 0, "format_pdf_orientation": "L", "format_pdf_page_size": "A4", "format_pdf_font_size": "8", "format_pdf_header_text": "", "format_pdf_footer_text": "", "format_pdf_pagination": "C", "format_pdf_fit_page_width": "0", "format_pdf_cols_width": "25", "format_pdf_cols_align": "L", "format_pdf_cols_vertical_align": "T", "format_pdf_page_header_text_color": "#000000", "format_pdf_page_footer_text_color": "#000000", "format_pdf_table_header_text_color": "#000000", "format_pdf_table_header_background_color": "#FFFFFF", "format_pdf_table_row_text_color": "#000000", "format_pdf_table_row_background_color": "#FFFFFF", "format_pdf_logo_source_id": "0", "format_pdf_logo_source": "", "format_pdf_logo_width": "0", "format_pdf_logo_height": "15", "format_pdf_logo_align": "R", "format_pdf_row_images_width": "15", "format_pdf_row_images_height": "15", "format_pdf_row_images_add_link": "0", "format_pdf_row_dont_page_break_order_lines": "0", "format_html_display_column_names": "1", "format_html_repeat_header_last_line": "0", "format_html_font_size": "13", "format_html_header_text": "", "format_html_footer_text": "", "format_html_cols_align": "L", "format_html_header_text_color": "#000000", "format_html_footer_text_color": "#000000", "format_html_table_header_text_color": "#000000", "format_html_table_header_background_color": "#FFFFFF", "format_html_table_row_text_color": "#000000", "format_html_table_row_background_color": "#FFFFFF", "format_html_row_images_width": "100", "format_html_row_images_height": "100", "format_html_images_add_link": "0", "format_html_custom_css": "", "all_products_from_order": "1", "skip_refunded_items": "0", "skip_suborders": "0", "export_refunds": "0", "export_matched_items": "0", "date_format": "Y-m-d", "time_format": "H:i:s", "sort_direction": "DESC", "sort": "order_id", "format_number_fields": "0", "export_all_comments": "0", "export_refund_notes": "0", "strip_tags_product_fields": "0", "strip_html_tags": "0", "round_item_tax_rate": "0", "cleanup_phone": "0", "convert_serialized_values": "0", "enable_debug": "0", "billing_details_for_shipping": "0", "custom_php": "1", "custom_php_code": "add_filter(\u0027woe_get_order_value__shipping_method_chronorelais\u0027,function( $value,$order, $fieldname ) {\r\n$data = maybe_unserialize($value);\r\nif(is_array($data)) $value = $data[\"id\"];\r\nreturn $value;\r\n}, 10, 3 );\r\n\r\n\/\/ only 1st tax rate will be exported\r\nadd_filter(\u0027woe_get_order_product_value_tax_percentage\u0027, function ($value, $order, $item, $product,$item_meta) {\r\n$taxes = $item->get_taxes();\r\nif ( empty($taxes[\u0027subtotal\u0027]) ) return 0;\r\nforeach($taxes[\u0027subtotal\u0027] as $tax_rate_id =>$amount) {\r\n$tax_percent = WC_Tax::get_rate_percent( $tax_rate_id );\r\n$tax_rate = str_replace(\u0027%\u0027, \u0027\u0027, $tax_percent); \/\/remove extra %\r\nreturn $tax_rate;\r\n}\r\nreturn 0;\r\n}, 10, 5);\r\n\r\nadd_filter(\u0027woe_get_order_product_value_item_coupon\u0027, function ($value, $order, $item, $product, $item_meta) {\r\n\r\n\t\/\/il faut comprendre qu\u0027un coupon est associ\u00e9 \u00e0 une commande, et pas \u00e0 une ligne \/ un produit de la commande\r\n\t\/\/alors que l\u00e0, on veut la remise qui est appliqu\u00e9e sur un produit\r\n\t\/\/on va donc parcourir les coupons et d\u00e9terminer si l\u0027un s\u0027applique au produit courant\r\n\tforeach ($order->get_coupon_codes() as $coupon_code) {\r\n\t\t$coupon = new WC_Coupon($coupon_code);\r\n\r\n\t\t\/\/on commence par s\u0027assurer qu\u0027il s\u0027agit d\u0027un remise en pourcentage : tout autre coupon est ignor\u00e9\r\n\t\tif ($coupon->get_discount_type() == \"percent\") {\r\n\t\t\t\/\/ensuite on regarde si le coupon s\u0027applique \u00e0 un produit en particulier ou \u00e0 tout le panier\r\n\t\t\t\/\/la r\u00e8gle d\u00e9finie ensemble est que si la liste de produits sur lesquels le coupon est application est vide, alors il s\u0027applique \u00e0 tous les produits du panier\r\n\t\t\t$product_ids=$coupon->get_product_ids();\r\n\t\t\tif (empty($product_ids)) {\r\n\t\t\t\treturn $coupon->get_amount();\r\n\t\t\t}\r\n\t\t\t\r\n\t\t\t\/\/sinon, on regarde sur quels produits le coupon est applicable\r\n\t\t\t\/\/si le produit courant en fait partie, on y applique le coupon\r\n\t\t\tif (in_array($product->get_id(), $product_ids)) {\r\n\t\t\t\treturn $coupon->get_amount();\r\n\t\t\t}\r\n\r\n\t\t\t\/\/si on arrive ici, c\u0027est donc que le coupon courant n\u0027est pas applicable au produit courant\r\n\t\t}\r\n\t}\r\n\t\/\/si on arrive ici, c\u0027est qu\u0027aucun coupon valide pour ce produit n\u0027a \u00e9t\u00e9 identifi\u00e9\r\n\t\/\/inversement \/ effet de bord : si plusieurs coupons sont applicables pour ce produit, on renvoie le premier trouv\u00e9 sans chercher plus loin\r\n\treturn 0;\r\n\r\n}, 10, 5);", "mark_exported_orders": "0", "export_unmarked_orders": "0", "summary_report_by_products": "0", "duplicated_fields_settings": { "products": { "repeat": "rows", "populate_other_columns": "1", "max_cols": "10", "group_by": "product", "line_delimiter": "\n" }, "coupons": { "repeat": "rows", "max_cols": "10", "group_by": "product", "line_delimiter": "\n" } }, "summary_report_by_customers": "0", "order_fields": [ { "segment": "common", "key": "static_field_2", "label": "Identifiant de ligne", "format": "string", "colname": "Identifiant de ligne", "value": "E" }, { "segment": "common", "key": "order_number", "label": "Order Number", "format": "string", "colname": "Order Number" }, { "segment": "common", "key": "static_field_6", "label": "Code site web", "format": "number", "colname": "Code site web", "value": "1" }, { "segment": "user", "key": "user_email", "label": "Customer User Email", "format": "string", "colname": "Customer User Email" }, { "segment": "user", "key": "customer_user", "label": "Customer User ID", "format": "number", "colname": "Customer User ID" }, { "segment": "common", "key": "order_date", "label": "Order Date", "format": "date", "colname": "Order Date" }, { "segment": "common", "key": "static_field_5", "label": "Edition TTC", "format": "", "colname": "Edition TTC", "value": "0" }, { "segment": "ship_calc", "key": "shipping_method_title", "label": "Shipping Method Title", "format": "string", "colname": "Shipping Method Title" }, { "segment": "common", "key": "static_field_11", "label": "Commentaire imprimable de fin", "format": "string", "colname": "Commentaire imprimable de fin", "value": "" }, { "segment": "common", "key": "static_field_9", "label": "Commentaire non imprimable", "format": "string", "colname": "Commentaire non imprimable", "value": "Paiement CB" }, { "segment": "ship_calc", "key": "order_shipping", "label": "Order Shipping Amount", "format": "money", "colname": "Order Shipping Amount" }, { "segment": "billing", "key": "static_field_3", "label": "Taux TVA Frais de port", "format": "number", "colname": "Taux TVA Frais de port", "value": "20" }, { "segment": "common", "key": "static_field_12", "label": "Remise sur frais de port en %", "format": "number", "colname": "Remise sur frais de port en %", "value": "0.00" }, { "segment": "common", "key": "static_field_13", "label": "Montant de remise sur frais de port (prioritaire sur %)", "format": "number", "colname": "Montant de remise sur frais de port (prioritaire sur %)", "value": "0.00" }, { "segment": "common", "key": "static_field_14", "label": "Remise sur articles en %", "format": "number", "colname": "Remise sur articles en %", "value": "0.00" }, { "segment": "common", "key": "static_field_15", "label": "Montant de remise sur articles (prioritaire sur %)", "format": "number", "colname": "Montant de remise sur articles (prioritaire sur %)", "value": "0.00" }, { "segment": "common", "key": "static_field_10", "label": "Mode de reglement", "format": "string", "colname": "Mode de reglement", "value": "Carte bancaire avec SIPS\/" }, { "segment": "common", "key": "static_field_16", "label": "Num\u00e9ro de TVA intracommunautaire", "format": "string", "colname": "Num\u00e9ro de TVA intracommunautaire", "value": "" }, { "segment": "common", "key": "plain_orders_gender_billing", "label": "gender_billing", "format": "", "colname": "gender_billing" }, { "segment": "billing", "key": "billing_last_name", "label": "Last Name (Billing)", "format": "string", "colname": "Last Name (Billing)" }, { "segment": "billing", "key": "billing_first_name", "label": "First Name (Billing)", "format": "string", "colname": "First Name (Billing)" }, { "segment": "billing", "key": "billing_company", "label": "Company (Billing)", "format": "string", "colname": "Company (Billing)" }, { "segment": "billing", "key": "billing_address_1", "label": "Address 1 (Billing)", "format": "string", "colname": "Address 1 (Billing)" }, { "segment": "billing", "key": "billing_address_2", "label": "Address 2 (Billing)", "format": "string", "colname": "Address 2 (Billing)" }, { "segment": "common", "key": "static_field_17", "label": "Ligne adresse 3 facturation", "format": "string", "colname": "Ligne adresse 3 facturation", "value": "" }, { "segment": "billing", "key": "billing_postcode", "label": "Postcode (Billing)", "format": "string", "colname": "Postcode (Billing)" }, { "segment": "billing", "key": "billing_city", "label": "City (Billing)", "format": "string", "colname": "City (Billing)" }, { "segment": "billing", "key": "billing_country", "label": "Country Code (Billing)", "format": "string", "colname": "Country Code (Billing)" }, { "segment": "billing", "key": "billing_phone", "label": "Phone (Billing)", "format": "string", "colname": "Phone (Billing)" }, { "segment": "common", "key": "static_field_18", "label": "Fax facturation", "format": "string", "colname": "Fax facturation", "value": "" }, { "segment": "billing", "key": "billing_email", "label": "Email (Billing)", "format": "string", "colname": "Email (Billing)" }, { "segment": "common", "key": "plain_orders_gender_shipping", "label": "gender_shipping", "format": "", "colname": "gender_shipping" }, { "segment": "shipping", "key": "shipping_last_name", "label": "Last Name (Shipping)", "format": "string", "colname": "Last Name (Shipping)" }, { "segment": "shipping", "key": "shipping_first_name", "label": "First Name (Shipping)", "format": "string", "colname": "First Name (Shipping)" }, { "segment": "shipping", "key": "shipping_company", "label": "Company (Shipping)", "format": "string", "colname": "Company (Shipping)" }, { "segment": "shipping", "key": "shipping_address_1", "label": "Address 1 (Shipping)", "format": "string", "colname": "Address 1 (Shipping)" }, { "segment": "shipping", "key": "shipping_address_2", "label": "Address 2 (Shipping)", "format": "string", "colname": "Address 2 (Shipping)" }, { "segment": "common", "key": "static_field_19", "label": "Ligne adresse 3 livraison", "format": "string", "colname": "Ligne adresse 3 livraison", "value": "" }, { "segment": "shipping", "key": "shipping_postcode", "label": "Postcode (Shipping)", "format": "string", "colname": "Postcode (Shipping)" }, { "segment": "shipping", "key": "shipping_city", "label": "City (Shipping)", "format": "string", "colname": "City (Shipping)" }, { "segment": "shipping", "key": "shipping_country", "label": "Country Code (Shipping)", "format": "string", "colname": "Country Code (Shipping)" }, { "segment": "common", "key": "static_field_20", "label": "T\u00e9l\u00e9phone livraison", "format": "string", "colname": "T\u00e9l\u00e9phone livraison", "value": "" }, { "segment": "common", "key": "static_field_21", "label": "Fax livraison", "format": "string", "colname": "Fax livraison", "value": "" }, { "segment": "common", "key": "static_field_22", "label": "E-mail livraison", "format": "string", "colname": "E-mail livraison", "value": "" }, { "segment": "ship_calc", "key": "plain_orders__shipping_method_chronorelais", "label": "_shipping_method_chronorelais", "format": "string", "colname": "_shipping_method_chronorelais" }, { "segment": "common", "key": "customer_note", "label": "Customer Note", "format": "string", "colname": "Customer Note" }, { "segment": "shipping", "key": "static_field_23", "label": "Envoi partiel de la commande", "format": "number", "colname": "Envoi partiel de la commande", "value": "" }, { "segment": "shipping", "key": "static_field_24", "label": "Paquet cadeau", "format": "", "colname": "Paquet cadeau", "value": "" }, { "segment": "shipping", "key": "static_field_25", "label": "Bloquer la commande", "format": "", "colname": "Bloquer la commande", "value": "" }, { "segment": "shipping", "key": "static_field_26", "label": "Valider la commande", "format": "", "colname": "Valider la commande", "value": "" }, { "segment": "shipping", "key": "static_field_27", "label": "Origine de la commande", "format": "", "colname": "Origine de la commande", "value": "" }, { "segment": "shipping", "key": "static_field_28", "label": "Informations sur la commande", "format": "", "colname": "Informations sur la commande", "value": "" }, { "segment": "shipping", "key": "static_field_29", "label": "Taux indicatif de change \u20ac \u2194 \u00a3", "format": "number", "colname": "Taux indicatif de change \u20ac \u2194 \u00a3", "value": "" }, { "segment": "shipping", "key": "static_field_30", "label": "Login du responsable", "format": "string", "colname": "Login du responsable", "value": "" }, { "segment": "shipping", "key": "static_field_31", "label": "Date de livraison pr\u00e9vue", "format": "date", "colname": "Date de livraison pr\u00e9vue", "value": "" }, { "segment": "shipping", "key": "static_field_32", "label": "R\u00e9f. commande de la market place", "format": "string", "colname": "R\u00e9f. commande de la market place", "value": "" }, { "segment": "shipping", "key": "static_field_33", "label": "R\u00e9f. commande", "format": "string", "colname": "R\u00e9f. commande", "value": "" }, { "segment": "products", "key": "products", "colname": "Products", "label": "Products", "format": "undefined" }, { "segment": "products", "key": "plain_products_static_field_2", "label": "Identifiant de ligne", "format": "", "colname": "Identifiant de ligne", "value": "L" }, { "segment": "products", "key": "plain_products_sku", "label": "SKU", "format": "string", "colname": "R\u00e9f\u00e9rence article" }, { "segment": "products", "key": "plain_products_name", "label": "Item Name", "format": "string", "colname": "Item Name" }, { "segment": "products", "key": "plain_products_qty_minus_refund", "label": "Quantity (- Refund)", "format": "number", "colname": "Quantity (- Refund)" }, { "segment": "products", "key": "plain_products_item_price_before_discount", "label": "Item Cost Before Discount", "format": "money", "colname": "Item Cost Before Discount" }, { "segment": "products", "key": "plain_products_item_coupon", "label": "item_coupon", "format": "money", "colname": "Coupon Amount" }, { "segment": "coupons", "key": "coupons", "colname": "Coupons", "label": "Coupons", "format": "undefined" }, { "segment": "products", "key": "plain_products_tax_percentage", "label": "tax_percentage", "format": "number", "colname": "tax_percentage" }, { "segment": "products", "key": "plain_products_static_field_3", "label": "Commentaire avant article", "format": "", "colname": "Commentaire avant article", "value": "" }, { "segment": "products", "key": "plain_products_static_field_4", "label": "Commentaire avant article", "format": "", "colname": "Commentaire avant article", "value": "" }, { "segment": "products", "key": "plain_products_static_field_5", "label": "Commentaire avant article", "format": "", "colname": "Commentaire avant article", "value": "" } ], "order_product_fields": [ { "label": "SKU", "format": "string", "colname": "SKU", "default": 1, "key": "sku" }, { "label": "Item #", "format": "number", "colname": "Item #", "default": 1, "key": "line_id" }, { "label": "Item Name", "format": "string", "colname": "Item Name", "default": 1, "key": "name" }, { "label": "Quantity (- Refund)", "format": "number", "colname": "Quantity (- Refund)", "default": 1, "key": "qty_minus_refund" }, { "label": "Item Cost", "format": "money", "colname": "Item Cost", "default": 1, "key": "item_price" } ], "order_coupon_fields": [ { "label": "Coupon Code", "format": "string", "colname": "Coupon Code", "default": 1, "key": "code" }, { "label": "Discount Amount", "format": "money", "colname": "Discount Amount", "default": 1, "key": "discount_amount" }, { "label": "Discount Amount Tax", "format": "money", "colname": "Discount Amount Tax", "default": 1, "key": "discount_amount_tax" } ], "id": 0, "post_type": "shop_order", "export_rule_field": "date", "export_filename": "orders-%y-%m-%d-%h-%i-%s.csv", "summary_row_title": "Total" }, "profiles": [], "cron": [], "order-action": [] }
hi
It’s hook name.
Please, read https://docs.algolplus.com/algol_order_export/hooks-filters/
Some examples https://docs.algolplus.com/algol_order_export/modify-existing-fields/thanks, Alex
So i try something like this based on what you send me but i still get no change in the column
add_filter(‘woe_get_order_value_shipping_first_name’, function ($value, $order,$fieldname,) {
$test = $order->get_shipping_first_name();
if (is_null($test)) {
$test = “test”;
}
return $test;
}, 10, 3);
try this code , don’t use is_null()
add_filter('woe_get_order_value_shipping_first_name', function ($value, $order,$fieldname,) {
if (empty($value)) {
$value = "test";
}
return $value;
}, 10, 3);Thank You
You’re welcome
It works for everything except one thing and i can’t see why is this possible ?
add_filter(‘woe_get_order_value_plain_orders_gender_shipping’, function ($value, $order, $fieldname) {
if (empty($value)) {
$value = $order->get_plain_orders_gender_billing();
}
return $value;
}, 10, 3);in my gender billing I have a value but not in my shipping its normal but I just want to put the billing value in the shipping column but I get nothing
$order is https://woocommerce.github.io/code-reference/classes/WC-Order.html
so you must use
$order->get_meta("gender_billing")
Ok I get it the value is good, but I think the problem is here
woe_get_order_value_plain_orders_gender_shipping’, function ($value, $order, $fieldname)
because even if I give a new value it doesn’t get aplly
this is my new codeadd_filter(‘woe_get_order_value_plain_orders_gender_shipping’, function ($value, $order, $fieldname) {
if (empty($order->get_meta(“gender_shipping”))) {
$value = $order->get_meta(“gender_billing”);
}
return $value;
}, 10, 3);i check $order->get_meta(“gender_billing”); and when i use in a another column i get the value so that why i’m thinking the problem is with the function name or something like this
hook name is woe_get_order_value_gender_shipping
- The topic ‘Make default value’ is closed to new replies.