对于 WooCommerce,我使用的是高级自定义字段插件跟踪我实际存储每个产品的位置。
当收到订单时,我希望能够查看管理编辑订单页面并查看项目的存储位置。这样我就可以抓着它发货了。
这是我想看到的图片:
希望这是有道理的。
我只想在 WordPress 的编辑订单管理页面上调用每个产品的单个产品 ACF 变量 (BinLocation)。对此有什么帮助吗?
Thanks.
Updated:使用挂钩的自定义函数woocommerce_before_order_itemmeta
动作挂钩,您将能够实现您正在寻找的目标:
add_action( 'woocommerce_before_order_itemmeta', 'storage_location_of_order_items', 10, 3 );
function storage_location_of_order_items( $item_id, $item, $product ){
// Only on backend order edit pages
if( ! ( is_admin() && $item->is_type('line_item') ) ) return;
// Get your ACF product value (replace the slug by yours below)
if( $acf_value = get_field( 'BinLocation', $product->get_id() ) ) {
$acf_label = __('Stored in: ');
// Outputing the value of the "location storage" for this product item
echo '<div class="wc-order-item-custom"><strong>' . $acf_value . $acf_label . '</strong></div>';
}
}
代码位于活动子主题(或主题)的任何 php 文件中,或者也位于任何插件 php 文件中。
此代码经过测试并可在 WooCommerce 版本 3 及更高版本中运行...
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)