• Resolved petterbergstrom

    (@petterbergstrom)


    Hi
    I do not use the top-up option, since it is emptying the cart and I need customers to buy products and “top up” at the same time. Instead I use a virtual product that gives cashback.
    So I hide the top-up button on the acccount wallet tab with
    add_filter(‘woo_wallet_is_enable_top_up’, ‘__return_false’);

    Works fine, but I would like to put a link there to the cashback product.
    The best would be an amount field and an add to cart-button, but it′s OK with just a link to the product too.
    How can I do this?

    /Petter`.

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

    (@subratamal)

    @petterbergstrom You can use woocommerce_after_my_account hook to place a link in WooCommerce my-account dashboard page.

    Thread Starter petterbergstrom

    (@petterbergstrom)

    Thanks, thought I have no idea how to use it….

    Would any of these solutions be possible:
    1. Make it possible to have the original top up-product in the cart, together with other products?
    2. Keep the top up-button on account wallet tab, but redirect it to my new cashback-product instead?

    Plugin Author Subrata Mal

    (@subratamal)

    @petterbergstrom Point no 1 is not possible.

    Thread Starter petterbergstrom

    (@petterbergstrom)

    OK, that′s to bad we cant make the top-up product work just like any product with cachback.

    But how to do point 2 then?

    Plugin Author Subrata Mal

    (@subratamal)

    You can use this code for that.

    add_filter(‘woo_wallet_nav_menu_items’, ‘woo_wallet_nav_menu_items’);

    function woo_wallet_nav_menu_items($items){
        // Replace $product_id with the id of the product you have created.
        $items['top_up']['url'] = get_permalink($product_id);
        return $items;
    }
    Plugin Author Subrata Mal

    (@subratamal)

    @petterbergstrom Also use

    add_filter('woo_wallet_rechargeable_product_id', 'woo_wallet_rechargeable_product_id');
    
    function woo_wallet_rechargeable_product_id(){
        // Replace $product_id with the id of the product you have created.
        return $product_id;
    }
    • This reply was modified 2 years, 10 months ago by Subrata Mal.
    Thread Starter petterbergstrom

    (@petterbergstrom)

    Thanks!
    I put both these codes in functions.php with Code Snippets?

    Thread Starter petterbergstrom

    (@petterbergstrom)

    Tried this now, and it makes my new cachback product work as the wallet top upp: you can not have other products in the same cart.

    Plugin Author Subrata Mal

    (@subratamal)

    @petterbergstrom Yes told you point 1 is not possible.

    Thread Starter petterbergstrom

    (@petterbergstrom)

    OK, then I think you misunderstood me. I did not want to turn my new caschback product into the topup-product, since I then can not have it in the same cart as other products. I just want people to be able to buy (or go just to) the product from the wallet tab.

    Plugin Author Subrata Mal

    (@subratamal)

    Okay then please remove this code.

    add_filter('woo_wallet_rechargeable_product_id', 'woo_wallet_rechargeable_product_id');
    
    function woo_wallet_rechargeable_product_id(){
        // Replace $product_id with the id of the product you have created.
        return $product_id;
    }
    Thread Starter petterbergstrom

    (@petterbergstrom)

    It does not work. I now have this code:

    
    add_filter(‘woo_wallet_nav_menu_items’, ‘woo_wallet_nav_menu_items’);
    function woo_wallet_nav_menu_items($items){
        // Replace $product_id with the id of the product you have created.
        $items['top_up']['url'] = get_permalink(24090);
        return $items;
    }

    And still the original top-up product is being used, not beeing able to add other products to cart.

    Plugin Author Subrata Mal

    (@subratamal)

    @petterbergstrom Please reach out to our support email [email protected] regarding this.

    Thread Starter petterbergstrom

    (@petterbergstrom)

    OK.

Viewing 14 replies - 1 through 14 (of 14 total)
  • The topic ‘Put link on account tab’ is closed to new replies.