Track Shopping Carts in Real-Time
Learn how to track shopping carts in real-time.
We'll cover the following
Track each cart
We’ll use Presence to track each ShoppingCartChannel
and the shopper’s cart item ID
s. Each change to a cart will dispatch an update to the CartTracker
, and the admin client will automatically receive the changes. Our process for this task will break down into these steps:
- Create a
CartTracker
module usingPhoenix.Presence
. - Connect
ShoppingCartChannel
to theCartTracker
. - Send cart updates to the
CartTracker
. - Configure
admin.js
to receive Presence updates. - Aggregate and display the information in the dashboard.
CartTracker
First, create the CartTracker
module under the sneakers_23_web/channels
directory.
Get hands-on with 1400+ tech skills courses.