Public Javascript API

  • Open cart drawer

    upside.ucd.helpers.ajaxCart.show();
    
  • Open cart drawer with fresh cart data

    upside.ucd.helpers.ajaxCart.load();
    

Any element having class open-drawer or href="/cart" will open the drawer when clicked.

  • Build cart drawer when you already have cart object

    // Build cart and open the drawer
    upside.ucd.helpers.ajaxCart.buildCart(cart);
    
    // Build cart but do not open the drawer
    upside.ucd.helpers.ajaxCart.buildCart(cart, false);
    
  • Close cart drawer

    upside.ucd.helpers.ajaxCart.hide();
    

    You can add a class close-drawer to a button/link. Clicking on that button/link will hide the drawer.

  • Check if cart drawer is visible

    // Returns true if visible
    upside.ucd.helpers.ajaxCart.visible();
    
  • Check if cart drawer is hidden

    // Returns true if visible. Notice the ! at start
    ! upside.ucd.helpers.ajaxCart.visible(); 
    
  • Get jQuery instance

    const jQuery = upside.ucd.jquery();
    
  • Get raw/original cart data

    const cart = upside.ucd.original_cart;