These events reference the Rebuy cart object. Rebuy keeps a copy of the Shopify cart, this means that cart add and cart change trigger even if this happens outside of a Rebuy feature. For example, if a customer adds an item to the cart from the product details page the add event will trigger.

Ready

Triggers when the cart object is ready and passes the cart object to the event details.

document.addEventListener('rebuy:cart.ready', function(event){ 
  console.log('rebuy:cart.ready event', event.detail); 
});

Add

Triggers when an item is added to the cart and passes in the cart object to the event details.

document.addEventListener('rebuy:cart.add', function(event){ 
  console.log('rebuy:cart.add event', event.detail); 
});

Change

Triggers when the cart changes (add, remove, quantity increase, quantity decrease) and passes in the cart object to the event details.

document.addEventListener('rebuy:cart.change', function(event){ 
  console.log('rebuy:cart.change event', event.detail); 
});

Enriched

Triggers when the cart is enriched (this brings additional information for subscription items) and passes in the cart object to the event details.

document.addEventListener('rebuy:cart.enriched', function(event){ 
  console.log('rebuy:cart.enriched event', event.detail); 
});