[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 10 posts - 1 through 10 (of 10 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?

    #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. ๐Ÿ˜€

    #2289331
    Sam

    Have you removed the hook location generate_menu_bar_items?

    I just tried this and it is not in the drop down menu. I then tried to set a custom hook as generate_menu_bar_items but it did not work.

    Thanks
    Sam

    #2289336
    David
    Staff
    Customer Support

    Hi there,

    in Customizer > General – is there an option to change the structure from Floats to Flexbox ?
    If so, it needs to be on flexbox for that hook to be accessible.

    #2289344
    Sam

    Yeah, I noticed that just after I sent that message. We never switched through fear of breaking things.

    I tested it on our staging site and…

    It messes with my display a little bit. Is it expected that the font-weight would change when you switch to flexbox?

    #2289347
    David
    Staff
    Customer Support

    Hmmm… it shouldn’t mess with any typography settings.
    If you want to start a new topic, where you can use the Private Information field to share a link to URL i cant take a look?

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