• Resolved rezvan jalilian

    (@rezvanjalilian66)


    Dear TeraWallet Support Team

    I hope you’re doing well. I am currently using the Woo Wallet plugin for my WooCommerce store, and I would like to integrate the wallet balance into the SMS notifications sent to customers after they complete a transaction.

    Could you please guide me on how I can include the wallet balance in the SMS? Specifically, I would like to show the customer’s current wallet balance in the notification message sent after an order is placed or updated.

    I have tried to use some custom code, but I am unsure how to properly implement the integration with the SMS system. Any help or documentation on this feature would be greatly appreciated.

    Thank you in advance for your support!

    Best regards
    rezvan jalilian

Viewing 4 replies - 1 through 4 (of 4 total)
  • Thread Starter rezvan jalilian

    (@rezvanjalilian66)

    I have created many codes, but none of them worked.
    The last code I wanted was to define the wallet balance in the SMS as a variable, like {wallet_balance}

     add_filter('pw_woocommerce_sms_order_variables', 'add_wallet_balance_to_sms_variables', 10, 2);

    function add_wallet_balance_to_sms_variables($order_variables, $order_id) {

    if (!$order_id) {
    return $order_variables;
    }


    $order = wc_get_order($order_id);
    if ($order) {

    $user_id = $order->get_user_id();

    if ($user_id) {
    $wallet_balance = woo_wallet()->wallet->get_wallet_balance($user_id);


    if ($wallet_balance !== false) {

    $order_variables['{wallet_balance}'] = wc_price($wallet_balance);
    } else {

    $order_variables['{wallet_balance}'] = __('Unavailable', 'woo-wallet');
    }
    } else {

    $order_variables['{wallet_balance}'] = __('Guest User', 'woo-wallet');
    }
    }

    return $order_variables;
    }

    Plugin Author Subrata Mal

    (@subratamal)

    @rezvanjalilian66 Please use the attached updated code.

    add_filter('pw_woocommerce_sms_order_variables', 'add_wallet_balance_to_sms_variables', 10, 2);

    function add_wallet_balance_to_sms_variables($order_variables, $order_id) {

    if (!$order_id) {
    return $order_variables;
    }


    $order = wc_get_order($order_id);
    if ($order) {

    $user_id = $order->get_user_id();

    if ($user_id) {
    $wallet_balance = woo_wallet()->wallet->get_wallet_balance($user_id, 'edit');


    if ($wallet_balance !== false) {

    $order_variables['{wallet_balance}'] = wc_price($wallet_balance);
    } else {

    $order_variables['{wallet_balance}'] = __('Unavailable', 'woo-wallet');
    }
    } else {

    $order_variables['{wallet_balance}'] = __('Guest User', 'woo-wallet');
    }
    }

    return $order_variables;
    }
    Thread Starter rezvan jalilian

    (@rezvanjalilian66)

    Unfortunately, in the text message, instead of sending the wallet amount, it sends:

    Hello,
    Your wallet balance is
    {wallet_balance}

    Thread Starter rezvan jalilian

    (@rezvanjalilian66)

    Thank you for your help and your excellent response speed.

    I’m open to any other solution that allows me to display the wallet balance in the SMS.

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

The topic ‘[NSFW] Inquiry About Displaying Wallet Balance in SMS Notifications’ is closed to new replies.