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

    (@subratamal)

    @nostile,

    I am afraid we don’t have any shortcode for mini wallet. But you can add mini wallet to your themes menu we have already have that feature. Please select menu location from WooWallet > settings > general.

    Thread Starter nostile

    (@nostile)

    Yes I know I can add it in theme menus

    What I wished to do is add it in right corner of the Header of my website like this:

    Woo Cart (BAL) | Account (Menu) | Wishlist | Cart

    However being unable to add it to a custom menu is preventing me from doing this and all my menus are already being utilized.

    I hope you understand.

    Plugin Author Subrata Mal

    (@subratamal)

    @nostile,

    Please use below code to get mini wallet shortcode.

    function woo_mini_wallet_callback() {
        if (!function_exists('woo_wallet') || !is_user_logged_in()) {
            return '';
        }
        ob_start();
        $title = __('Current wallet balance', 'woo-wallet');
        $mini_wallet = '<a class="woo-wallet-menu-contents" href="' . esc_url(wc_get_account_endpoint_url(get_option('woocommerce_woo_wallet_endpoint', 'woo-wallet'))) . '" title="' . $title . '">';
        $mini_wallet .= woo_wallet()->wallet->get_wallet_balance(get_current_user_id());
        $mini_wallet .= '</a>';
        echo $mini_wallet;
        return ob_get_clean();
    }
    add_shortcode('woo-mini-wallet', 'woo_mini_wallet_callback');

    Thanks and Regards,
    Subrata Mal

    Thread Starter nostile

    (@nostile)

    Thanks, it works

    How about the wallet icon?

    Hello,

    How exactly do you use this code for the mini-wallet?

    Plugin Author Subrata Mal

    (@subratamal)

    @mikeyhash,

    Copy and paste the above code to activate themes function.php file. And use [woo-mini-wallet] shortcode to any post or page content.

    @subratamal,

    Thank you for your answer, man. It works nicely.

    However, same as @nostile’s question above, how about the mini wallet icon? Because the mini wallet shortcode only displays the amount of the current wallet balance, without the icon.

    How do I add the wallet icon?

    (@educationguideonline)

    I wanted to add an icon to the shortcode. But doesn’t work. Please help me.

    function woo_mini_wallet_callback() {
    if (!function_exists(‘woo_wallet’) || !is_user_logged_in()) {
    return ”;
    }
    ob_start();
    $title = __(‘Current wallet balance’, ‘woo-wallet’);
    $mini_wallet = ‘<i class=”fa fa-wallet”></i> ‘;
    $mini_wallet .= ‘‘;
    $mini_wallet .= woo_wallet()->wallet->get_wallet_balance(get_current_user_id());
    $mini_wallet .= ‘
    ‘;
    echo $mini_wallet;
    return ob_get_clean();
    }

    Thanks bro working fine,

    But the problem is its not showing icon of the mini wallet.

    Plugin Author Subrata Mal

    (@subratamal)

    @bilal266,
    Please use this updated code.

    function woo_mini_wallet_callback() {
        if (!function_exists('woo_wallet') || !is_user_logged_in()) {
            return '';
        }
        ob_start();
        $title = __('Current wallet balance', 'woo-wallet');
        $mini_wallet = '<a class="woo-wallet-menu-contents" href="' . esc_url(wc_get_account_endpoint_url(get_option('woocommerce_woo_wallet_endpoint', 'woo-wallet'))) . '" title="' . $title . '">';
        $mini_wallet .= '<img style="width:16px;height:16px;float:left;margin:4px;" src="' . WOO_WALLET_ICON . '" /> ';
        $mini_wallet .= woo_wallet()->wallet->get_wallet_balance(get_current_user_id());
        $mini_wallet .= '</a>';
        echo $mini_wallet;
        return ob_get_clean();
    }
    add_shortcode('woo-mini-wallet', 'woo_mini_wallet_callback');

    Hi bro,
    Thanks for replying, its working finw now.

    • This reply was modified 6 years, 7 months ago by bilal266.

    Hi,

    Which file do you edit to put this code? To have wallet close to Account-Shopping Cart?

    function woo_mini_wallet_callback() {
    if (!function_exists(‘woo_wallet’) || !is_user_logged_in()) {
    return ”;
    }
    ob_start();
    $title = __(‘Current wallet balance’, ‘woo-wallet’);
    $mini_wallet = ‘‘;
    $mini_wallet .= woo_wallet()->wallet->get_wallet_balance(get_current_user_id());
    $mini_wallet .= ‘
    ‘;
    echo $mini_wallet;
    return ob_get_clean();
    }
    add_shortcode(‘woo-mini-wallet’, ‘woo_mini_wallet_callback’);

    Thank you.

Viewing 12 replies - 1 through 12 (of 12 total)
  • The topic ‘Mini Wallet Shortcode?’ is closed to new replies.