Okay
  Public Ticket #3207115
Hiding the Wholesale price list
Closed

Comments

  •  1
    Neil started the conversation

    Hi

    I can't seem to hide the Wholesale price list table from Guests, also is there a redirect for Wholesale users to automatically go to the price list?

    I'm also trying to show ex VAT next to the product price, is there a way to do that?

    And lastly I want to show the normal retail price to guests and then only show the wholesale price to logged in wholesale users but I can only have both or none, is there an option for this.

    Thanks!

  •  2,218
    WebWizards replied

    Hi Neil,

    Thank you for purchasing our plugin!


    1) To show the cream order form only to logged in wholesale users, please use the following shortcode on your page:

    [b2bking_content show_to=b2b][b2bking_bulkorder theme=cream][/b2bking_content]
    

    I took the order form shortcode and put it inside the content shortcode.


    2) Are you looking for a login redirect? so that B2B users are taken to that page immediately when they first login?

    I think I can send you a code snippet for that, but please confirm for me first, so I can send the correct snippet.


    3) To show 'ex VAT' next to the product price, please go to B2BKing -> Settings -> Other and enable "Modify VAT suffix automatically"

    8804664919.png

    (this will make it say ex. VAT if you have a tax exemption configured for B2B users)


    4) If I understand correctly, when you're logged in as a wholesale user, you're seeing both retail and wholesale prices, but you want to see only the wholesale price?

    I think the issue is a specific setting. Please go to B2BKing -> Settings -> Other and disable "Show B2C price to B2B users".


    Looking forward to your response,


    Kind regards,

    Stefan



  •  1
    Neil replied

    Hi Stefan

    Thanks for the shortcode works perfectly.

    The redirect I've tested and it goes to the my account page, this is for when I go to /wp-admin and /my-account and login.

    With regards to the Tax thing, basically when the B2B is logged in and they visit the product page what I wanted is the Wholesale price to be ex VAT, at the moment it says ex VAT but that's not the ex VAT price (attached image). The ex VAT is R21,000.

    I can hide this for now but if there is a way to have this that would be a bonus.


    Thanks for the help!

    Attached files:  Screenshot 2023-01-15 at 10.23.20.png

  •  1
    Neil replied

    Hi

    I'm struggling to get the frontend product to display B2C pricing with TAX (for logged in B2B users) and then show the Wholesale price ex VAT,  at the moment it shows the other way around.

    The back end Bulk show ex VAT which is perfect.

    Do you have something that can fix this for me?

    Attached files:  Screenshot 2023-01-16 at 11.41.38.png

  •  2,218
    WebWizards replied

    Hi Neil,

    To display wholesale prices excluding VAT for B2B users, we need to configure a VAT exemption, as per: https://woocommerce-b2b-plugin.com/docs/how-to-display-prices-excluding-tax-for-b2b-users-and-including-tax-for-b2c-users/


    If you would like to share a backend login to the site / staging site with us, I can look into that directly and set it up for you.

    To redirect to a specific page after login (other than the my account page), you could add this PHP code snippet to your site:

    add_filter( 'woocommerce_login_redirect', 'login_redirect', 10, 2 );
    function login_redirect( $redirect, $user ) {
        return get_permalink(1234);
    }
    

    You would need to replace 1234 with the ID of the page you want to redirect to. To get the ID of a page, edit that page and check the number in the URL. It would contain a number such as ?post=123 which is the ID.


    Kind regards,

    Stefan

  •  1
    Neil replied

    Hi Stefan

    I have tried what was mentioned in that article but the product page doesn't display the ex VAT price for the wholesale price only, only the Bulk order is correct. I also wanted the retail to be left alone so it did include VAT like it would for the public, this is for the B2B user.

  •  2,218
    WebWizards replied

    Hi Neil,

    If I understand correctly, you'd like the retail price to show as INC VAT.

    To do this, please add this PHP code snippet to your site:

    add_filter('b2bking_both_prices_retail_adjust_tax','__return_false');
    add_filter('b2bking_display_both_cache_disable','__return_true');
    

    A PHP snippet can be added to functions.php, or by following our guide here: https://woocommerce-b2b-plugin.com/docs/how-to-add-a-snippet-php-or-js/


    Let me know if that solved it,

  •  1
    Neil replied

    Hi Stefan

    It didn't work, I've attached the screenshot etc

    Thanks

    Attached files:  Screenshot 2023-01-17 at 19.49.06.png
      Screenshot 2023-01-17 at 19.49.01.png

  •  2,218
    WebWizards replied

    Something to check:

    With that snippets plugin it's easy to accidentally add the snippet but not activate it. Please go to the main snippets page and check that its status is active: https://prnt.sc/uwOu9yIlBLTb


    If that's not it, could you share a backend login to the site / staging site? I am not sure what the issue is and I would like to run a few tests and look into it,

  •   Neil replied privately
  •  2,218
    WebWizards replied

    Thank you for the login,

    The reason that didn't work immediately is because prices are entered excl. VAT and this is currently not fully supported in WooCommerce when it comes to VAT exemptions: https://github.com/woocommerce/woocommerce/issues/27012


    I think I found a solution though. I see there's a single VAT rate on your site, 15%, so I just add that to the price 'manually' through this snippet here: https://solar.co.za/wp-admin/admin.php?page=wpcode-snippet-manager&snippet_id=399640


    This is the result: 

    4553080045.png


    Let me know if that works for your needs,

  •  1
    Neil replied

    That's great, thanks!

  •  1
    Neil replied

    Hi

    With regards to the redirect of logged in users to a the wholesale price list, how can I do this without B2B not being in a user role, typically you could do something like this:

    function redirect_users_by_role() {    
        $current_user = wp_get_current_user();
        $role_name = $current_user->roles[0];   
        if('specuserrole' === $role_name && is_page('home')) {       
            wp_redirect('website.com/userole');     
            exit();    
        }  
    } 
    add_action('init', 'redirect_users_by_role');

    But since you don't register as a role on WP (from what I can see) how can I achieve the same thing?

  •  2,218
    WebWizards replied

    If I understand correctly you want to apply this code only to B2B users?

    In that case, you can change the code to the following:

    function redirect_users_by_role() {    
        $user_id = get_current_user_id();
        $is_b2b = get_user_meta($user_id,'b2bking_b2buser', true);
        if ($is_b2b === 'yes' && is_page('home')){
            wp_redirect('website.com/userole');     
            exit();  
        }
    } 
    add_action('init', 'redirect_users_by_role');