Transactions registered twice
-
I am testing the following shortcode to add credit programmatically. The wallet balance is updated but the transaction table registered the credit twice so, ultimately, the balance has twice the amount. Please I’ll appreciate your help.
// Test Shortcode
function testsc_shortcode() {
$user_id = get_current_user_id();
$amount = 18;
$payment_type = ‘credit’;
// $payment_type = ‘debit’;$description = ‘Testing’;
// $amount = apply_filters( ‘woo_wallet_addjust_balance_amount’, number_format( $amount, wc_get_price_decimals(), ‘.’, ” ), $user_id );
if ( ‘credit’ === $payment_type) {
$transaction_id = woo_wallet()->wallet->credit( $user_id, $amount, $description);
} else if ( ‘debit’ === $payment_type) {
$transaction_id = woo_wallet()->wallet->debit( $user_id, $amount, $description);
}$abc = woo_wallet()->wallet->get_wallet_balance( $user_id );
return ($abc);
}
add_shortcode(‘testsc’, ‘testsc_shortcode’);
- The topic ‘Transactions registered twice’ is closed to new replies.