wpswings / wallet-system-for-woocommerce

The Wallet System for WooCommerce plugin is an in-store digital wallet that helps registered customers to purchase your products and services using available wallet balance. Customers can also recharge their WooCommerce wallets by using any of the supported payment options. The admin can also analyse the list of transactions and wallet users.
https://wordpress.org/plugins/wallet-system-for-woocommerce/
GNU General Public License v3.0
1 stars 5 forks source link

Programmatically add to wallet #194

Open petermorlion opened 6 months ago

petermorlion commented 6 months ago

I'm looking for a simple wallet plugin, but I need to be able to add to the wallet programmatically. I'm developing a custom plugin for a customer, and depending on certain actions/events in my plugin, I need to add funds to a user's wallet. So in code, instead of allowing the user to do so. Is this possible?

WP-Swings commented 6 months ago

Hi @petermorlion , Thanks for putting your query here. We have independent function through which you can credit or debit amount from users wallet. Here are the functions name which you can use: wps_wsfw_update_user_wallet_balance - debit wps_wsfw_credit_user_wallet_balance -- credit

The parameters for these functions are required ($user_id, $amount, $order_id = ''). Hope this will work for you as per your need . Best Regards

petermorlion commented 6 months ago

Thank you for your response!

petermorlion commented 4 months ago

I've finally gotten round to implementing my feature which uses these methods. Except, they don't seem to do anything. On closer inspection, I notice two "weird" things:

  1. These functions aren't used by your plugin
  2. Inside the function, there is a check to see if the wps_wallet user meta isn't empty. On first run, this metadata will probably be "empty" because the record hasn't been added to the database yet, right?

So could it be these functions won't ever work?

WP-Swings commented 4 months ago

Hello @petermorlion ,

Here are the answers to your queries:

  1. We created these functions specifically for client support so that clients can extend the functionality according to their needs.
  2. We have fixed this issue in our branch. You can copy the code of that file from here: class-wallet-system-for-woocommerce-dependency.php.
petermorlion commented 4 months ago

Yes, that works! I assume 2.5.14 will be available soon (it's not available now, is that due to the recent security issue)?

petermorlion commented 4 days ago

Hi all, thanks again for the updates. I'm wondering if you would be willing to add an extra parameter to these functions, in order to add a message/description to the transactions?