Docs
STEP 3-1

unmount: Remove a banner

unmount(): void

A method of the object that mount() returns. Removes only the banner shown by that mount(). The element you passed to mount() and its other content stay. The SDK keeps running, and other banners, callbacks, and checkout button handling are not affected.

  • When to call: When you discard the element that shows the banner (for example, when the cart drawer closes).
  • To shut down the whole SDK, use destroy(). The differences are shown in the table below.

Exceptions and failures

  • Exceptions: None.
  • After destroy(): It does nothing.
  • After mount() is called again on the same element: The unmount() returned by the previous mount() does nothing, and the new banner stays (mount()).

Differences between unmount() and destroy()

What you callWhat is removedSDK stateWhen to use it
unmount()That one bannerKeeps runningWhen closing a drawer, or when only the component that holds the banner is discarded
destroy()The whole CheckoutPlusSession (including all banners)Shut downWhen the component that initialized the SDK is discarded, or when recreating the CheckoutPlusSession
Nothing—Discarded along with the pageWhen navigating to checkout, or when moving to another page with a full page load
© Recustomer, Inc.