Site logo

[Support request] Hide cart in menu for a specific user role

Home Forums Support [Support request] Hide cart in menu for a specific user role

Home Forums Support Hide cart in menu for a specific user role

Viewing 15 posts - 16 through 30 (of 33 total)
  • Author
    Posts
  • #2194689
    Deyson

    At this time I have been able to get all links to go to checkout. The one that I am not able to get the icon.

    Also, if you may share both recommendations to have everything go to checkout please do as I want to be sure I am doing it correctly.

    Thank you and have an amazing day! ๐Ÿ˜Š

    #2194696
    David
    Staff
    Customer Support

    Try this snippet:

    add_filter( 'woocommerce_get_cart_url', 'db_custom_cart_url' );
    function db_custom_cart_url() {
        return 'your checkout url here';
    }
    #2194776
    Deyson

    Thank you! ๐Ÿ˜Š

    May I use /checkout/ for the “URL here”?

    #2195008
    David
    Staff
    Customer Support

    That one would require the full url eg. https://mysite.com/checkout/

    #2195145
    Deyson

    Thank you.

    Also, it seems if the cart is empty and we get directed to the checkout it creates an endless loop.

    Please let me know what you think. ๐Ÿค”

    #2195177
    David
    Staff
    Customer Support

    Do you have any other codes that is changing Cart links to the Checkout ?

    #2195186
    Deyson

    I guess I did. I am sorry for that.

    Thank you for your patience and have an amazing day! ๐Ÿ˜Š

    #2195240
    David
    Staff
    Customer Support

    No need to apologise. Did you get the issue resolved ?

    #2195334
    Deyson

    Yes sir! ๐Ÿ˜Š
    P.S. I found a great plugin called Query Monitor to help identify the most taxing plugins. ๐Ÿ˜Š

    #2195618
    David
    Staff
    Customer Support

    Awesome – glad to hear that!

    #2196931
    Deyson

    Hello.

    Is it possible to combine your code with this one:
    https://stackoverflow.com/questions/63631987/woocommerce-always-redirect-to-checkout-even-if-product-already-exists-in-cart

    Since I sell digital downloads individually, I would rather my customer heads to checkout instead of seeing a warning if a product is already in the cart.

    Please let me know what you think. ๐Ÿค”
    Thank you and have an amazing day! ๐Ÿ˜Š

    #2197147
    David
    Staff
    Customer Support

    So run me by the logic.

    What happens if the product isn’t already in the cart ?

    #2197272
    Deyson

    Hello, David! ๐Ÿ˜Š

    If the product is or is not in the cart it all goes to the checkout the same.

    Currently, with the code, you had shared with me if the product is in the cart we get a Notification message on the product page that reads “You cannot add another “Produce Name” to your cart. View Cart”

    With the code I had linked above, it redirects to the Checkout page, but the Mini Icon takes me to the Cart. I would like everything to go to the checkout page.

    Please let me know what you think. ๐Ÿค”
    Thank you and have an amazing day! ๐Ÿ˜Š

    #2197646
    David
    Staff
    Customer Support

    If the cart icon only serves the purpose of taking you to the Checkout ( ie. there is not mini cart submenu ). Then it may be easier to disable the Menu Cart, and use a Block Element to insert your own icon with a link to the checkout.

    You can use the menu_bar_items hook to position it in the same place.

    Is that an acceptable solution?

    #2197690
    Deyson

    In the future, I may want to turn it back on.
    But, I will try that out. I will go look through your documentation to figure out how to do this.

    Thank you and have an amazing day! ๐Ÿ˜Š

Viewing 15 posts - 16 through 30 (of 33 total)
  • You must be logged in to reply to this topic.