Overview
AJAX cart recommendations appear when customers view their cart in a slide-out drawer or popup. These recommendations update dynamically as customers add or remove items from their cart.Implementation Steps
1. Create AJAX Section
First, create a new section in your Glood.AI dashboard:- Go to Sections in your Glood.AI admin
- Click Create New Section
- Select AJAX Cart as the page type
- Configure your desired recommendation strategy
- Save the section
2. Place Section in Mini Cart
Add the section html (from section details page) to your theme’s mini cart template:3. Configure Load/Unload Hooks
To control when the AJAX cart recommendations load and unload, implement these hooks in your section template:Page speed
With Load recommendations on demand turned on in the app embed, the mini cart’s recommendations download when the drawer opens, instead of with every page. Sections added with the section HTML are picked up automatically. If the section is placed with a location selector instead, set Widget selector to that location. See Optimize Page Speed.Testing
To verify your implementation:- Add an item to your cart
- Open the mini cart
- Verify that recommendations appear
- Close the mini cart
- Verify that recommendations are removed
- Test with different cart contents to ensure recommendations update
Troubleshooting
Common issues and solutions:- Recommendations don’t load: Verify your section ID and ensure the mini cart element selector matches your theme
- Recommendations don’t update: Check that loadAjaxCart and unloadAjaxCart hooks are properly configured
- Performance issues: Consider adjusting the number of recommended products shown
Next Steps
- Customize the recommendation layout to match your theme
- Add tracking to measure recommendation performance
- Configure product filtering rules