dashed-slug.net › Forums › Fiat Coin Adapter extension support › Useful Info For Woocommerce And FIAT deposits
- This topic has 2 replies, 3 voices, and was last updated 4 years, 9 months ago by alexg.
-
AuthorPosts
-
February 4, 2019 at 7:27 pm #5777megeanwassonParticipant
Hi Everyone,
This may be of use to any of you who want to use woocommerce shop and FIAT currencies with your wallets plugins to accept FIAT Cash Deposits.
I use this method on some of my personal crypto websites and it works like a dream.
Alex may be able to advise some extra functionality on the provided code to automate the last manual step 🙂Description
This method can be used to allow you to create a woocommerce product to accept FIAT Deposits in ANY chosen fiat currency and then gives you an Order Action that you can use to easily credit the deposited currency to the customers chosen FIAT Wallet.Requirements
Dashed-Slug Plugins:
Bitcoin and Altcoin Wallets
Bitcoin and Altcoin Wallets: Fiat Coin Adapter extension
Bitcoin and Altcoin Wallets: Full Node Multi Coin Adapter extension
Bitcoin and Altcoin Wallets: Exchange extension
Bitcoin and Altcoin Wallets: WooCommerce Cryptocurrency Payment Gateway
Alex’s Alt Coins Adapter PluginThen For Woocommerce Setup And Activate The Following Extra Plugins:
WooCommerce Conditional Shipping and Payments (Set to allow only Bank Deposit/Transfers for FIAT Deposit Product)
WooCommerce Name Your Price (Let client choose how much to deposit)
WooCommerce Payment Gateway Based Fees (Charge A FIAT Deposit Commission To Cover any Fees To Complete Transaction)
Booster Plus for WooCommerce (Activate Currency Exchange Rates and Currency per Product Modules)Sites Default Currency Is USD for purposes of this demonstration, you can however use any of the currencies as your default to work with this method.
Setup Your FIAT DEPOSIT Products (I used GBP as example here):
After activating and setting up everything you can Add to your child Theme functions.php the following code at the bottom.
Alex could you suggest how we can automate adding the currency to the customers wallet in here, the code would most likely go near the bottom where I put ( // Code Goes Here )/** * Add a custom FIAT WALLET DEPOSIT action to order actions select box on edit order page * Only added/Shown for paid orders that haven't fired this action yet * * @param array $actions order actions array to display * @return array - updated actions */ function wallets_wc_add_order_meta_box_action( $actions ) { global $theorder; // bail if the order has been completed or this action has already been run if ( ! $theorder->is_paid() || get_post_meta( $theorder->id, '_wc_order_marked_fiat_deposit_processed', true ) ) { return $actions; } // add "Mark Fiat Deposit Completed Action" custom action t the order processing page $actions['wc_custom_order_action'] = __( 'Add Fiat Deposit To Clients Wallet Balance', 'my-textdomain' ); return $actions; } add_action( 'woocommerce_order_actions', 'wallets_wc_add_order_meta_box_action' ); /** * Add the wallets fiat deposit order note when action is clicked * Move Deposited Currency Amount to the customers Coin Wallet Balance * Add a flag on the order to show it's been run * * @param \WC_Order $order */ function wallets_note_wc_process_order_meta_box_action( $order ) { // get correct info variables to be used to execute the code to credit the correct currency and amount to the users coin wallet balance $thewalletuserordernumber = $order->get_id(); // The Order Number Can Be Pushed Into The Wallet Transaction Comment/Reference $thewalletuserid = $order->get_user_id(); $thewalletuserordercurrency = $order->get_currency(); // get the order currency $thewalletusersordertotaldeposited = $order->get_total(); // Currency total paid and cleared on order completion $deposit_address = apply_filters( 'wallets_api_deposit_address', '', array( 'symbol' => $thewalletuserordercurrency, 'user_id' => $thewalletuserid, 'check_capabilities' => true, 'force_new' => false, ) ); $isordercompletedornot = $order->get_status( ); // Still To Add the code here to automatically credit the Deposited Currency amount to the users corresponding Currency Coin Wallet // Code Goes Here // add the order note to show admin the Currency amount was successfully credited to the customers coin wallet $message = sprintf( __( 'Order '.$isordercompletedornot.' - '.$thewalletuserordercurrency.'%s Added To User ID:<b>'.$thewalletuserid.'</b>\'s Wallet Balance With Deposit Address: <b>'.$deposit_address.'</b>', 'my-textdomain' ), $thewalletusersordertotaldeposited); $order->add_order_note( $message ); // add the flag so that this action won't be shown again after successfully processed update_post_meta( $order->id, '_wc_order_marked_fiat_deposit_processed', 'yes' ); } add_action( 'woocommerce_order_action_wc_custom_order_action', 'wallets_note_wc_process_order_meta_box_action' );
See Customer ordering FIAT Deposit and processing steps next:
Now admin can process the customers Fiat Deposit order next:
If anyone have suggestions how we can improve this then please do let me know 🙂
Kind Regards
MeganJune 23, 2019 at 2:45 pm #6526AnonymousInactiveplease can you resend the images?
March 2, 2020 at 11:57 am #7834alexgKeymasterplease repost the images
-
AuthorPosts
- You must be logged in to reply to this topic.