> ## Documentation Index
> Fetch the complete documentation index at: https://docs.orderprotection.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Rebuy

> Add Order Protection to your Rebuy Smart Cart.

<Note>
  Order Protection integrates with Rebuy Smart Cart by adding our widget directly into your cart drawer — no theme edits required.
</Note>

## Before you begin

This integration requires a **Checkout+** Order Protection widget — one that renders its own **Secure Checkout** button rather than only a toggle. If you're not sure which version you have, or your cart doesn't render its own checkout button, reach out to your Customer Success Manager or shared Slack channel before starting. Setting this up on a non-Checkout+ widget requires additional work on our side to avoid a checkout-button conflict with Rebuy's own handler.

<Warning>
  **Don't use Rebuy's built-in "Order Protection" app integration.** Under **Smart Cart → Apps**, Rebuy lists its own native Order Protection toggle. Enabling it loads an old, legacy version of our widget alongside your current one — resulting in two protection rows in the cart and an inconsistent customer experience. If this toggle is currently enabled on your account, turn it **off** before following the steps below.
</Warning>

## Installation

<Tip>Before you begin, confirm the Order Protection script is already loading on your storefront — check your theme for a `<script>` tag pointing to `cdn.orderprotection.com/cart-widget/...`. Rebuy's Custom Code block strips out `<script>` tags, so the widget script itself must already be loading from your theme, not from the block you're about to create.</Tip>

<Steps>
  <Step title="Open Custom Code in Rebuy">
    In your Rebuy admin, go to **Smart Cart → Custom Code**, and place the block in the cart **footer**.
  </Step>

  <Step title="Add the Order Protection element and styles">
    Paste the following into the Custom Code block. This keeps your existing subtotal in place and replaces Rebuy's native checkout button with Order Protection's own **Secure Checkout** button, so the flow reads Subtotal → Order Protection → Secure Checkout.

    ```html theme={null}
    <order-protection></order-protection>
    <style>
      #rebuy-cart [data-rebuy-cart-anchor="footer"] {
        display: flex;
        flex-direction: column;
      }
      #rebuy-cart [data-rebuy-cart-anchor="footer"] [data-rebuy-component="cart-subtotal"] {
        order: 1;
      }
      #rebuy-cart [data-rebuy-cart-anchor="footer"] [data-rebuy-custom-code] {
        order: 2;
      }
      #rebuy-cart [data-rebuy-component="checkout-area"] {
        display: none !important;
      }
    </style>
    ```

    <Note>
      If your Rebuy cart uses the default template, its DOM uses `.rebuy-cart__flyout-*` classes instead of the `data-rebuy-*` attributes above. Open your live cart preview first and check which structure your store uses, then swap in the matching class selectors (for example `.rebuy-cart__flyout-subtotal` and `.rebuy-cart__flyout-actions`) before saving.
    </Note>
  </Step>

  <Step title="Save and test">
    Save the Custom Code block, then open your storefront and add a product to the cart. You should see exactly one Order Protection row in the drawer. Run a real test checkout to confirm the Secure Checkout button adds the Order Protection line item and reaches your checkout page.
  </Step>
</Steps>

### All done

<Check>
  Order Protection will now render inside your Rebuy Smart Cart for every customer, using your Secure Checkout button as the single path to checkout. Customers can file and edit claims per your normal store settings once an order is placed.
</Check>

## Want the subtotal hidden too?

If you'd rather not show a subtotal above the Order Protection widget at all, you can additionally hide `[data-rebuy-component="cart-subtotal"]` (or `.rebuy-cart__flyout-subtotal` on default templates) and drop the `flex`/`order` rules above. Keep in mind the Checkout+ widget doesn't display a running total on its own, so with this variant your cart won't show a price until checkout.

## Questions?

If your cart doesn't render its own checkout button, or you run into anything unexpected while setting this up, reach out to your Customer Success Manager or your shared Slack channel — our team can get this configured with you directly.
