How to display the sidecart with link

I'm trying to have a link on my page that displays the side cart. Simply appending #fc-sidecart to the URL does not do the trick. Is this even possible?
Tagged:
Comments
  • fc_adamfc_adam FoxyCart Team
    @pinksharpii,

    Definitely possible - you'd just create a normal link to your store, but with the cart=view parameter. So if your store was example.foxycart.com, the URL would be https://example.foxycart.com/cart?cart=view. You can see other details about interacting with the cart on our wiki at https://wiki.foxycart.com/v/2.0/cart#viewing_the_cart
  • Okay that works for a normal link. But what about if I have an element that when clicked I want to have it do the same thing.
    $("#header #fc_quantity").on('click', function(){
    window.location.href = 'https://example.foxycart.com/cart?cart=view';
    });
    This does not work and just brings the user to the page without the sidecart.
  • fc_jedfc_jed FoxyCart Team
    @pinksharpii

    You could try calling a function like this:
    <script>
    function callSidecart() {
    FC.sidecart.show();
    }
    </script>
    <button onclick="callSidecart()">VIEW CART</button>
    I've added a button for you to test, but feel free to call the function from wherever you want.
Sign In or Register to comment.