• Updating from Version 1.5.15
    to 1.6.0

    The user’s balance is being incorrectly multiplied by 3

    Latest Woo. Curcy – latest version.

    I customised your plugin by:

    wp-content/plugins/woo-wallet/includes/helper/woo-wallet-util.php

    changing:
    $allowed_order_cols = array( 'transaction_id', 'user_id', 'amount', 'date', 'type', 'deleted' );

    with:
    $allowed_order_cols = array( 'transaction_id', 'user_id', 'amount', 'date', 'type', 'deleted', 'currency' );


    And added in functions.php
    add_filter( 'woo_wallet_transactions_query', function ( $query ) { if ( isset( $query[0] ) && ! isset( $query['select'] ) ) { $map = array( 'select', 'from', 'join', 'where', 'order_by', 'limit' ); $assoc = array(); foreach ( $map as $i => $key ) { if ( isset( $query[ $i ] ) ) { $assoc[ $key ] = $query[ $i ]; } } return $assoc; } return $query; }, 1 );

    • This topic was modified 4 days, 19 hours ago by alveree.
Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Author Subrata Mal

    (@subratamal)

    Hi @alveree Thanks for reaching out. Could you please share screenshot of user transaction details or share a user wallet transactions by exporting using our plugin exporter? So that we can look into this issue.

    Thread Starter alveree

    (@alveree)

    Hi,
    This isn’t a data issue but it’s a code bug in 1.6.0.
    I’ve already identified the root cause and applied a local fix.

    Bug 1:currency missing from allowed columns whitelist

    In includes/helper/woo-wallet-util.php, get_wallet_transactions() now has a column whitelist:

    $allowed_order_cols = array( 'transaction_id', 'user_id', 'amount', 'date', 'type', 'deleted' );

    currency is not included. Any where clause filtering by currency is silently skipped.

    This breaks CURCY (VillaTheme Multi Currency), which hooks woo_wallet_current_balance and loops over each configured currency, calling get_wallet_transactions() with array('key' => 'currency', 'value' => $currency). Since the currency filter is silently dropped, every iteration returns ALL transactions instead of only those for that currency. With 3 currencies configured, the balance is multiplied by exactly 3.

    Fix: add 'currency' to $allowed_order_cols.

    Bug 2: woo_wallet_transactions_query filter changed from associative to indexed array

    The old version passed an associative array to apply_filters('woo_wallet_transactions_query', $query) with keys select, from, join, where, order_by, limit. The new version passes an indexed array (0–5). Any filter callback accessing $query['where'] (which CURCY’s woo_wallet_transactions_query filter does at line 336 of plugins/woo-wallet.php) breaks silently.

    This is a breaking change for any third-party code using this filter.

    Both bugs are in the plugin code, not in my data.

    Plugin Author Subrata Mal

    (@subratamal)

    @alveree Thanks for the details. We’ve added the currency field to the $allowed_order_cols variable.

    Regarding the second issue, we’ve implemented dedicated multi-currency support within our plugin. However, it appears that CURCY (VillaTheme Multi Currency) also includes code that interacts with our plugin, which may be causing the conflict.

Viewing 3 replies - 1 through 3 (of 3 total)

You must be logged in to reply to this topic.