You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

WooCommerce编辑订单页面退款区域复选框位置调整求助

WooCommerce编辑订单页面退款区域复选框位置调整求助

大家好,我最近在给WooCommerce订单编辑页面添加自定义复选框时遇到了位置问题,想请各位帮忙出出主意。

我写了一段代码,原本希望自定义复选框能显示在“Restock refunded items”选项的前面,但实际运行后,它却出现在了Order Total的后面,完全不是我想要的位置:

function add_custom_checkbox_after_restock($order_id) {

$order = wc_get_order($order_id);

$restock_refunded_items = $order->get_meta('_restock_refunded_items', true);

echo '<div class="edit-field">

<label for="custom_checkbox">' . __('Custom Checkbox Label', 'your-theme-textdomain') . '</label>

<input type="checkbox" class="checkbox" name="custom_checkbox" id="custom_checkbox" value="1" ' . checked($restock_refunded_items, 'yes', false) . ' />

</div>';

}

add_action('woocommerce_admin_order_totals_after_total', 'add_custom_checkbox_after_restock');

有没有朋友知道怎么调整这段代码,让我的自定义复选框能显示在“Restock refunded items”选项的前面呀?麻烦指点一下,谢谢啦!

备注:内容来源于stack exchange,提问作者thecodedeveloper.com

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.04.22 10:29:33