Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/296.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Php WooCommerce订阅+;WP基金_Php_Wordpress_Woocommerce_Hook Woocommerce_Woocommerce Subscriptions - Fatal编程技术网

Php WooCommerce订阅+;WP基金

Php WooCommerce订阅+;WP基金,php,wordpress,woocommerce,hook-woocommerce,woocommerce-subscriptions,Php,Wordpress,Woocommerce,Hook Woocommerce,Woocommerce Subscriptions,我需要通过帐户资金向用户帐户中添加资金,以便通过WooCommerce订阅成功续订其会员资格 有没有办法通过WP功能实现这一点?如果是这样,我该怎么做?我试过以下方法,但没有成功 add_action('processed_subscription_payment', 'custom_add_funds', 10, 2); function custom_add_funds($user_id) { // get current user's funds $funds = ge

我需要通过帐户资金向用户帐户中添加资金,以便通过WooCommerce订阅成功续订其会员资格

有没有办法通过WP功能实现这一点?如果是这样,我该怎么做?我试过以下方法,但没有成功

add_action('processed_subscription_payment', 'custom_add_funds', 10, 2);

function custom_add_funds($user_id) {

    // get current user's funds
    $funds = get_user_meta( $user_id, 'account_funds', true );

    // add £40
    $funds = $funds + 40;

    // add funds to user
    update_user_meta( $user_id, 'account_funds', $funds );

}
账户资金:

订阅: