用于订单更新的 Woocommerce 挂钩 [英] Woocommerce hook for order update

查看:37
本文介绍了用于订单更新的 Woocommerce 挂钩的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家早上好.正如标题所说,我正在尝试在订单更新时触发一个函数.更具体地说,我想在更改订单页面(管理端)中的自定义字段然后保存时运行此功能.

Good morning everyone. As the title says I'm trying to fire a function when an order is updated. More specifically I want to run this function when a custom field in the order page (admin side) is changed and then saved.

我不是想知道订单何时完成或其状态何时更新,而是想知道此字段何时更新.

I'm not looking to find out when an order is complete or when its status is updated, but just when this field is updated.

目前我正在使用 woocommerce_process_shop_order_meta 钩子,但它似乎不起作用.

Currently I'm using woocommerce_process_shop_order_meta hook but it doesn't seem to work.

有什么建议吗?
谢谢!

Any advice?
Thank you!

-- 编辑 --

woocommerce_process_shop_order_meta 是正确的钩子,我在这个钩子触发的函数中出错,所以如果你在管理页面点击更新订单后需要运行一个函数,这是正确的做法.

woocommerce_process_shop_order_meta is the righ hook to use, I was having an error in the function triggered by this hook so if you ever need to run a function after you click update order in the admin page this is the right way to do it.

推荐答案

如编辑中所写,woocommerce_process_shop_order_meta 是正确的钩子,如果您想在下订单时触发函数或响应正在更新.

As written in the edit the woocommerce_process_shop_order_meta is the right hook to use if you want to trigger a function or a response when an order is update.

这篇关于用于订单更新的 Woocommerce 挂钩的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆