• Resolved kavalterbang

    (@kavalterbang)


    Hi,

    First i want to mention that the website language is mostly in Indonesian, and the cart page link i provided above will probably be empty, if showing the button is necessary for review, then please add a few products to show the chat to order button.

    And for the question:
    Is it possible to hide the chat to order button from guests?
    Afaik, the only possible way is through HTML/CSS Codes.
    But, i’m still new to coding and stuff, so i don’t really know the button ID or Class (correct me if i’m wrong).
    If it’s possible, then any infomartion is appreciated.

    Regards,
    Valdi

    The page I need help with: [log in to see the link]

Viewing 5 replies - 1 through 5 (of 5 total)
  • Plugin Author walterpinem

    (@walterpinem)

    Hi.

    Yes, I provided the Indonesian translation for the plugin users who have set Bahasa Indonesia as their main site language.
    You can change the language to English instead.

    Also about your question, I don’t quite understand it but if you just want to hide all WhatsApp buttons from displaying to non-logged in users (guest), you can try this snippet:

    // Hide button for guests
    function wa_order_hide_button_for_guests()
    {
        if ( ! is_user_logged_in() ) 
        {
          ?>
            <style>
              #sendbtn {
                display: none!important;
              }
            </style>
          <?php    
        }
    }
    add_action('wp_head', 'wa_order_hide_button_for_guests');

    Above code goes to your child theme’s functions.php or custom code snippet plugin.
    Code tested and works.

    Please test it and let me know the result.

    Thread Starter kavalterbang

    (@kavalterbang)

    Hi,

    Before i try the code, will it work if i use Custom CSS on the WordPress page editor?
    Also, thank you for the quick response.

    Regards,
    Valdi

    Plugin Author walterpinem

    (@walterpinem)

    Hi.

    The code I provided is indeed included a custom CSS, but need certain condition to implement it as intended.
    In order for it to work for your case (hide WA button for non-logged in users), you need a conditional logic in it.
    That’s why there is if ( ! is_user_logged_in() ) condition to instruct WordPress to implement this CSS: #sendbtn { display: none!important; } only for non-logged in users.

    Without the function, there’s no way you can execute the conditional logic to hide WA button for guests.

    Please try it and let me know the result.

    Thanks.

    • This reply was modified 4 years, 4 months ago by walterpinem.
    Thread Starter kavalterbang

    (@kavalterbang)

    Hi,

    I added the code to custom code snippet plugin, and it works!
    Thank you so much for the help!
    I’ll be sure to post here if i’m having troubles with Chat to Order Plugin.

    Regards,
    Valdi

    Plugin Author walterpinem

    (@walterpinem)

    Hi.

    I’m glad it worked out for you.
    Thanks for your confirmation.

    I’m marking this topic as resolved.
    If you face another issue or have another question, please do not hesitate to open a new topic.

    Thanks.

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Hide Chat to Order Button’ is closed to new replies.