root
loader inside loadCriticalData
.
root
loader. This pending data is then passed down to the Cart
component and awaited in a <Suspense>
wrapper.
customer.state == "enrolled"
. Customers in any other state are not eligible to redeem rewards.
customer.available_rewards
array.
Free product rewards will have kind == "product_cart"
.
Next, iterate each reward and render it along with an action button to redeem the reward. You’ll
need to check each reward’s context.can_redeem.state
to determine if the customer can redeem the reward,
and, if they can’t, the reason why, which is useful to display to the customer.
active_cart_redemption.cart_line
object, which includes the necessary information you need to add to the cart
using the Storefront APIrequested_cart_actions
in the response.
These actions indicate the changes, if any, that need to made to the cart. Currently
this is limited to removing lines from the cart, because we’ve cancelled their
associated redemption. This might be because the redemption expired, or because
its requirements are no longer met by the cart (e.g. the cart total is too low).
In our reference implementation, we stash these requested line IDs to remove on
the LoyaltyLionData
object, pass them down to the Cart
component, and then
use a hook which will remove the lines from the cart by submitting an action.