For the complete documentation index, see llms.txt. This page is also available as Markdown.

Cart & Checkout

The SDK does not manage the shopping cart internally. You are responsible for:

  • Maintaining cart state

  • Managing cart items

  • Handling checkout flow

The SDK provides callbacks and configuration options for cart integration. This page covers:

Shopping CTA Button

The shopping CTA button appears on the product detail page and triggers the add-to-cart or shop-now action.

Product details page - CTA button (3)

CTA Button Click Listener

Handle clicks on the shopping CTA button:

CTA Button Status

For long-running operations (e.g., adding to cart via API), notify the SDK of the operation status:

Status Types:

  • CtaButtonStatus.Loading - Operation in progress

  • CtaButtonStatus.Success - Operation completed successfully

  • CtaButtonStatus.Error - Operation failed

Note: If status is not provided within 10 seconds, the SDK assumes the operation failed.

CTA Button Text

Choose between "Add to cart" and "Shop now" labels:

Usage Guidelines:

  • Add to cart: Use when shopping cart is enabled

  • Shop now: Use for direct navigation to product pages without cart

Customize Shopping CTA Button

You can customize the "Add to Cart" button appearance by overriding the FwShoppingCtaButtonStyle in your app's theme:

Basic Styling

Shape Customization

To customize button shape (rounded corners, etc.):

Shopping Cart

Cart Behavior

Configure how the shopping cart behaves using CartBehaviour:

Available Behaviors:

  1. CartBehaviour.NoCart (Default)

    • Shopping cart icon is hidden

    • Suitable for "Shop now" mode without cart

  2. CartBehaviour.Callback

    • Cart icon is shown

    • OnCartActionListener.onCartClicked is triggered when clicked

    • Use when opening cart as a separate activity

  3. CartBehaviour.Embedded

    • Cart icon is shown

    • Fragment from EmbeddedCartFactory is displayed when clicked

    • Requires calling setEmbeddedCartFactory first

Embedded Cart Example

Cart Click Listener

Important: This listener only works with CartBehaviour.Callback.

Product details page - Cart icon (1)

Product Detail Page (PDP)

Product details page - PDP link (2)

Handle clicks on the PDP link button:

Return Value:

  • true - Your app handles the navigation

  • false - SDK opens the product page

Control whether the PDP link button is shown:

"Shop Now" Mode

Configure the SDK for direct product page navigation without a shopping cart:

Error Handling

Implement OnShoppingErrorListener to receive shopping error events:

Error Types

Programmatic Control

Dismiss Shopping UI

Close the shopping interface programmatically:

Open Shopping Cart

Open the shopping cart programmatically:

Last updated

Was this helpful?