• Resolved sadiqodunsi

    (@sadiqodunsi)


    There seem to be a problem with the code to get wallet topup form. If I add the shortcode to a page and click on publish or update, the page gives this error “Updating failed”. Although, the page will actually update even though it gives that error. Additionally, the form page on the front-end does not respect any styling. I think this is because of the error. I want the form page to be max-width: 700px; but it’s always showing in full with. The code is below. Please review.

    // Shortcode for getting only topup form [woo-wallet-topup]
    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
    }
    
    
Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)

The topic ‘Problem with Shortcode for getting only topup form’ is closed to new replies.