小编Mil*_*imi的帖子

支付成功后,Woocommerce 中会触发什么 hook

在 Woocommerce 中,要向客户发送短信付款信息,我需要在成功付款后激活触发器。

但我没有找到任何钩子来做

这是我的插件代码:

if ( isset( $this->options['wc_notify_customer_payment_successful_enable'] ) ) {
    add_action( '####Action to be used here#######', array( &$this, 'successful_payment_notification_client' ) );
}

/* WooCommerce Successful payment notification client 
 *
 * @param $order_id
 */
public function successful_payment_notification_client ( $order_id ) {
    // Check the mobile field is empty
    if ( empty( $_REQUEST['mobile'] ) ) {
        return;
    }
    $order          = new WC_Order( $order_id );
    $this->sms->to  = array( $_REQUEST['mobile'] );
    $template_vars  = array(
        '%order_id%'           => $order_id,
        '%order_number%'       => $order->get_order_number(),
        '%status%'             => …
Run Code Online (Sandbox Code Playgroud)

php wordpress payment woocommerce hook-woocommerce

5
推荐指数
1
解决办法
1万
查看次数

标签 统计

hook-woocommerce ×1

payment ×1

php ×1

woocommerce ×1

wordpress ×1