对于一个非政府组织,我正在建立一个包含 WooCommerce 和 WooCommerce 订阅、会员和团队的电子学习订阅网站。它提供 5 天的试用期,以及信用卡和 bacs 付款。 他们希望 bacs(银行转帐)付款能够自动完成,以避免在试用后手动更改状态。如果未付款,他们将手动暂停订阅。 我已尝试使用以下挂钩在 5 天后续订订阅时更改状态,但未更改状态。
add_action('woocommerce_subscription_renewal_payment_complete', 'subscription_payment_complete_hook_callback', 10, 1);
function subscription_payment_complete_hook_callback( $subscription ) {
// Get the current order
$current_order = $subscription->get_last_order( 'all', 'any' );
// For bacs recurring orders
if( $current_order->get_payment_method() === 'bacs' ) {
// Update status to completed
$current_order->update_status('completed');
}
}
关于什么是错误的任何想法?