• Resolved charmp121

    (@charmp121)


    I have read all directions on setting up shortcode or widget to display cashback balance. I have tried all directions and add snippet to theme functions but it does not seem to work. Can you check to make sure it is working.
    Thanks.

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

    (@subratamal)

    @charmp121,

    Cashback balance? Are you referring how much cashback credited to a perticular user?

    Thread Starter charmp121

    (@charmp121)

    Yes, would like to display the current user’s wallet balance either as a shortcode or widget I could add to certain pages. Please review and advise.
    Thanks.

    Plugin Author Subrata Mal

    (@subratamal)

    @charmp121,

    Here is the 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');
    Thread Starter charmp121

    (@charmp121)

    Ok, perfect works great.
    Thank you.

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Shortcode or widget??’ is closed to new replies.