• Resolved amankr

    (@amankr)


    Hi,
    I need a want to create a button somewhere on my webpage to be able to topup wallet by clicking on it . How can I do this.

    Can I have the shortcode only for wallet top , wallet transaction details , balance details individually.

Viewing 1 replies (of 1 total)
  • Plugin Author Subrata Mal

    (@subratamal)

    @amankr

    Use below code in theme function.php file to create wallet top-up shortcode.

    add_action('init', 'add_woo_wallet_topup_shortcode');
    
    function add_woo_wallet_topup_shortcode() {
        if (!is_admin()) {
            add_shortcode('woo-wallet-topup', 'woo_wallet_topup_shortcode_callback');
        }
    }
    
    function woo_wallet_topup_shortcode_callback() {
        ?>
        <form method="post" action="">
            <div class="woo-wallet-add-amount">
                <label for="woo_wallet_balance_to_add"><?php _e('Enter amount', 'woo-wallet'); ?></label>
                <?php
                $min_amount = woo_wallet()->settings_api->get_option('min_topup_amount', '_wallet_settings_general', 0);
                $max_amount = woo_wallet()->settings_api->get_option('max_topup_amount', '_wallet_settings_general', '');
                ?>
                <input type="number" step="0.01" min="<?php echo $min_amount; ?>" max="<?php echo $max_amount; ?>" name="woo_wallet_balance_to_add" id="woo_wallet_balance_to_add" class="woo-wallet-balance-to-add" required="" />
                <?php wp_nonce_field('woo_wallet_topup', 'woo_wallet_topup'); ?>
                <input type="submit" name="woo_add_to_wallet" class="woo-add-to-wallet" value="<?php _e('Add', 'woo-wallet'); ?>" />
            </div>
        </form>
        <?php
    }

    Thank you.

Viewing 1 replies (of 1 total)
  • The topic ‘Wallet top up Shortcode’ is closed to new replies.