php - Woocommerce - 在 Shipstation 中将自定义数据作为行项目发送
问题描述
我有以下代码将自定义详细信息添加为 WooCommerce 中的订单行项目
add_action( 'woocommerce_checkout_create_order_line_item', 'wdm_add_custom_order_line_item_meta', 10, 4 );
function wdm_add_custom_order_line_item_meta( $item, $cart_item_key, $values, $order ) {
if( array_key_exists( 'wdm_name', $values ) ) {
$item->add_meta_data( '_wdm_name', $values['wdm_name'] );
}
}
以下是我尝试将自定义数据添加到 Shipstations 自定义字段但失败:
add_filter( 'woocommerce_shipstation_export_custom_field_2', '__return_true' );
add_filter( 'woocommerce_shipstation_export_custom_field_2_value', 'woo_shipstation_custom_field_2_value', 10, 2 );
function woo_shipstation_custom_field_2_value() {
return '_wdm_name'; // Replace this with the key of your custom field
}
自定义详细信息当前已记录并添加到我的 WooCommerce 管理员订单页面中。但是这些自定义细节在 Shipstation 中不可见。我正在考虑将自定义数据作为新行项目发送,而不是发送到 Shipstation 中的自定义字段。这是你可以帮助我的事情吗?
解决方案
推荐阅读
- optimization - 日期时间到字符串,在 F# 中,这可以进一步优化吗?
- postgresql - PostgreSQL:更小的时间戳类型?
- html - 为什么ajax在html模板中返回循环的最新变量?
- javascript - Sequelize 包含嵌套列:“where 子句”中的未知列
- firebase - Dart firebase 和等价物
- batch-file - 在批处理文件中使用完整路径或相对路径
- azure - Azure:如何找到容器注册表的所有者或资源 ID?
- snowflake-cloud-data-platform - 我如何从多个表中复制到?雪花
- heroku - Heroku错误?说我的 package.json 缺少东西
- firebase - 如何在一个查询中结合“where”、“starAt”和“limit” [FIREBASE,REACT NATIVE,REDUX]