【问题标题】:Show up Woocommerce custom fileds into the CSV export在 CSV 导出中显示 Woocommerce 自定义字段
【发布时间】:2014-02-11 10:50:31
【问题描述】:

我正在使用“Woocommerce CSV Export”插件,我刚刚在我的 WC 结帐页面中添加了 2 个自定义文件,我想知道是否可以将这些文件添加到导出插件中。

【问题讨论】:

    标签: woocommerce custom-fields


    【解决方案1】:

    只需将以下代码添加到您的“woocommerce-export-csv.php”中

    add_filter( 'woocommerce_export_csv_extra_columns', 'sites_add_custom_meta', 10);
    

    定义你的功能

    function sites_add_custom_meta() {
      $custom_meta_fields['columns'][] = 'IP Address';
      $custom_meta_fields['data'][] = '_customer_ip_address';
      return $custom_meta_fields;
    }
    

    在此函数中,您需要定义两件事。首先,在列数组中,您需要定义自定义元字段的标题,然后在数据数组中,您需要定义该字段的数据所在的实际元字段名称。您需要在两个数组中具有相同的顺序才能在右列标题下输出正确的信息。

    来源:http://docs.woothemes.com/document/ordercustomer-csv-exporter/#section-4

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2018-08-26
      • 2021-05-14
      • 2020-06-21
      • 1970-01-01
      • 2018-04-12
      • 1970-01-01
      • 2021-10-06
      相关资源
      最近更新 更多