[Support request] Point the shopping cart icon in the header to a shortcode instead of the cart

Home Forums Support [Support request] Point the shopping cart icon in the header to a shortcode instead of the cart

Home Forums Support Point the shopping cart icon in the header to a shortcode instead of the cart

Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
    Posts
  • #1981191
    wickedonline

    Hi,

    We are using a slider cart and they have provided us with a short code to point the cart button to. How can we change the destination of the cart so it can point to the slider cart?

    I’ve tried this code, I just need to be able to insert the short code where it says http://www.google.com

    add_filter( ‘woocommerce_get_cart_url’, ‘tu_custom_cart_url’ );
    function tu_custom_cart_url() {
    return ‘www.google.com’;
    }

    This is the short code we want to call:
    [checkoutwc_cart]

    #1981225
    Ying
    Staff
    Customer Support

    Hi there,

    Not sure what are you trying to achieve, this php snippet can only change the URL of cart.

    Can you tell me what exactly you want to achieve?

    And can you also show me what content does this shortcode present? You can do it by insert in a page and link us to the page so we can have a rough idea.

    Let me know ๐Ÿ™‚

    #1981308
    wickedonline

    I would like for when you click the cart icon up top to point here:

    [checkoutwc_cart]

    If you add something to cart it will show what we are trying to display when you click the cart icon up top.

    #1981515
    Elvin
    Staff
    Customer Support

    Hi there,

    Filtering the cart’s URL will only change the URL of the link of the cart icon. It won’t do anything else.

    If you’re expecting a popup to show up from that shortcode when you filter the URL then that’s not what’s going to happen.

    Can you explain a bit more on your expected behavior?

    A wise man once said:
    "Have you cleared your cache?"

    #1981526
    wickedonline

    I would like to open the slide out cart when you click the cart icon. I don’t want it to go to the cart page. I have included a link to a product so you can click the add to cart button and see the slide out cart. Thanks

    #1981534
    Elvin
    Staff
    Customer Support

    If that’s the case then what you need is to remove the default cart icon and then create a Hook Element to add the shortcode in.

    To remove the cart icon, go to Appearance > GeneratePress and active the WooCommerce module.

    Once activated, go to Appearnce > Customize > Layout > WooCommerce and uncheck “Display cart in menu”. This should remove the default cart icon.

    You then add the shortcode through a Hook element. You can create a Hook element on Appearance > Elements if you have Elements module enabled on Appearance > GeneratePress.

    On the Hook Element’s code area, add [checkoutwc_cart].

    You then set the hook to generate_menu_bar_items and set the display rule location to entire site. You’ll also have to check the “Execute shortcode” checkbox and save the Hook Element.

    This should add the shortcode inplace of the cart icon. ๐Ÿ˜€

    A wise man once said:
    "Have you cleared your cache?"

Viewing 6 posts - 1 through 6 (of 6 total)
  • You must be logged in to reply to this topic.