> ## Documentation Index
> Fetch the complete documentation index at: https://docs.glood.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# How to reload mini cart sections using javascript

This comprehensive guide explains how to reload mini cart sections in your Glood application using JavaScript.

## Overview

The Glood framework offers two primary JavaScript methods for managing mini cart sections:

* `window.glood.loadPage('ajax_cart')` - Loads or reloads the mini cart section
* `window.glood.unloadPage('ajax_cart')` - Unloads the mini cart section

These methods allow you to update cart content based on user interactions, server responses, or application state changes.

## Prerequisites

Before implementing mini cart reloading functionality, ensure that:

1. **Glood Framework**: The Glood framework is properly loaded on your page
2. **Global Object**: The `window.glood` object is available and accessible
3. **Section Configuration**: The `ajax_cart` section is properly configured in your application

## Basic Implementation

### Simple Reload

You can reload the mini cart section by using this code in your section template:

```javascript theme={null}
if (window.glood && shouldLoadAjaxCart && typeof window.glood.loadPage === 'function') {
  window.glood.loadPage('ajax_cart');
}
```

### Basic Unload

To unload the mini cart section:

```javascript theme={null}
if (window.glood && shouldUnloadAjaxCart && typeof window.glood.unloadPage === 'function') {
  window.glood.unloadPage('ajax_cart');
}
```

## Conditional Load/Unload

For more advanced scenarios where you need to conditionally load or unload the mini cart section based on specific conditions, use this code:

```javascript theme={null}
if (
  window.glood &&
  shouldLoadAjaxCart &&
  typeof window.glood.loadPage === 'function'
) {
  window.glood.loadPage('ajax_cart')
} else if (
  shouldUnloadAjaxCart &&
  typeof window.glood.unloadPage === 'function'
) {
  window.glood.unloadPage('ajax_cart')
}
```

This code checks for the Glood framework availability and your custom conditions (`shouldLoadAjaxCart` and `shouldUnloadAjaxCart`) to either load or unload the mini cart section accordingly.

## Support

If you need help with setting up or customizing mini cart section reloading, contact our support team at [support@glood.ai](mailto:support@glood.ai)
