1

Create API Account

An API account is used to securely access your store via OAuth using BigCommerce’s APIs. After completing the steps below, please send the information generated to onboarding@orderprotection.com.

  1. From the BigCommerce control panel, go to Settings › Store-level API Tokens and click + Create API Account.
  2. Select V2/V3 API token for the token type.
  3. Enter OrderProtection.com for the name.
  4. Under OAuth scopes, select the required permissions for each resource.
  5. Click Save. A pop-up will display your API credentials. A text file will also be downloaded with these details plus your API path.
  6. Email the contents of the text file to onboarding@orderprotection.com. Please include the Client ID, Client secret, Access token, and API path.

Note: There is no way to return to this pop-up after you dismiss it, so make sure you copy the information and send it to us as soon as possible.

  1. Back on the Store-level API accounts screen, click the menu for the OrderProtection.com API account you just created, and click Edit.
  2. Click the Notification email tab, enter support@orderprotection.com under Email for webhook notifications, then click Save.

Note: This address may not save until after Order Protection onboards your store and the webhooks are created. Please check this setting again after your store has been onboarded to verify the address is saved.

That’s it! Once we receive the details requested above, we will onboard your store to our backend and reach out to coordinate installing the widget in your theme.

2

Installation

  1. Select the account and then store you are working on.

  1. Go to Storefront › Theme and copy a Current Theme by clicking Advanced › Make a Copy.

  1. Rename the copied theme using the following example: qeretail-2024 [OP–29/04/2025]. Where qeretail-2024 is the theme name and [OP–29/04/2025] marks that Order Protection was added to this theme on 29/04/2025.

  2. Once the copy finalizes, click the three dots and then Edit Theme Files.

3

Code Block Configurations

Cart Page: Navigate Templates > Layouts > base.html. Copy and Paste this code above the {{{footer.scripts}}} line. The highlighted code will need to be adjusted to your store credentials.

Checkout Page: Navigate Templates > Pages > checkout.html. Copy and Paste the code next to the other <script> tags. The highlighted code will need to be adjusted to your store credentials.

<!-- Order Protection Styling -->
<link
  rel="stylesheet"
  href="https://cdn.orderprotection.com/widget/shopify/5.9.3/style.css"
/>
<!-- End of Order Protection Styling -->

<!-- Order Protection Widget -->
<script
  crossorigin
  src="https://cdn.orderprotection.com/widget/big-commerce/5.27.1/orderprotection.js"
></script>

<script defer>
  const widget = OrderProtection.createOrderProtectionWidget({
    store_url: "store-nd5f5zgf3.mybigcommerce.com",
    locations: [
      {
        sibling: {
          position: "before",
          selector: ".cart-total",
          // Uncomment the following block to apply custom styles:
          /*
            styles: {
            'width': '350px',
            'margin-left': 'auto'
            }
            */
        },
      },
    ],
    text: {
      LOGO_TEXT: "testing",
      INFORMATION_TEXT: "testing info",
    },
  });
  function updateMainCartCount() {
    const cart = widget.cart.cart;
    const cartItems = cart.lineItems;
    const hasOp = cartItems.digitalItems.some(
      (item) => item.name === "Order Protection"
    );

    if (!hasOp) return;
    const countElm = document.querySelector("[data-cart-page-title]");
    if (!countElm) return;
    const numberMatch = countElm.innerText.match(/\d+/);
    if (!numberMatch) return;
    const currentNumber = numberMatch[0];
    const newCount = widget.cart.item_count - 1;
    const newText = countElm.innerText.replace(currentNumber, newCount);
    countElm.innerText = newText;
  }

  function updateHeaderCartCount() {
    const cart = widget.cart.cart;
    const cartItems = cart.lineItems;
    const hasOp = cartItems.digitalItems.some(
      (item) => item.name === "Order Protection"
    );

    if (!hasOp) return;
    const headerCountElm = document.querySelector(
      ".countPill.countPill--positive.cart-quantity"
    );
    if (!headerCountElm) return;
    headerCountElm.innerText = widget.cart.item_count - 1;
  }

  function updateSubtotal() {
    const cart = widget.cart.cart;
    const cartItems = cart.lineItems;
    const hasOp = cartItems.digitalItems.some(
      (item) => item.name === "Order Protection"
    );

    if (!hasOp) return;

    const OpItem = cartItems.digitalItems.find(
      (item) => item.name === "Order Protection"
    );
    const totalNoOp = cart.cartAmount - OpItem.listPrice;
    const formatter = new Intl.NumberFormat(undefined, {
      style: "currency",
      currency: cart.currency.code,
    });
    const formattedSubtotal = formatter.format(totalNoOp);
    const subtotalElm = document.querySelector(".cart-total-value > span");
    const subtotalElm2 = document.querySelector(
      ".cart-total-value.cart-total-grandTotal > span"
    );
    if (subtotalElm && subtotalElm2) {
      subtotalElm.innerText = formattedSubtotal;
      subtotalElm2.innerText = formattedSubtotal;
      clearInterval(updateSubtotal);
    }
  }

  function updateCartCountAndSubtotals() {
    updateMainCartCount();
    updateHeaderCartCount();
    updateSubtotal();
  }

  widget.addPlugin({
    afterInit: () => updateCartCountAndSubtotals(),
    afterRemoveFromCart: () => updateCartCountAndSubtotals(),
    afterAddToCart: () => updateCartCountAndSubtotals(),
  });

  widget.init();

  setInterval(() => {
    widget.attach();
  });
</script>
<script>
  document.addEventListener("DOMContentLoaded", () => {
    const cartItems = document.querySelectorAll(".cart-item");
    cartItems.forEach((item) => {
      const name = item.querySelector(".cart-item-name").innerText.trim();
      if (name === "Order Protection") {
        item.style.display = "none";
      }
    });
  });
</script>

<!-- End of Order Protection Widget -->
4

Customize Widget Labeling (If Needed)

To customize the widget text labels, add the following configuration to your widget initialization:

  1. In both the Cart Page and Checkout sections, locate the widget initialization code:
const widget = OrderProtection.createOrderProtectionWidget({
  store_url: "store-nd5f5zgf3.mybigcommerce.com",
});
  1. Add the text configuration object before the closing bracket below the store_url:
const widget = OrderProtection.createOrderProtectionWidget({
  store_url: "store-nd5f5zgf3.mybigcommerce.com",
  // ... other configurations ...
  text: {
    LOGO_TEXT: "testing",
    INFORMATION_TEXT: "testing info",
  },
});
  1. Customize the text values according to your needs:
    • LOGO_TEXT: The text displayed next to the logo
    • INFORMATION_TEXT: The informational text shown in the widget

Note: Make sure to add this configuration to both the Cart Page and Checkout widget implementations to maintain consistency.

5

Hide Order Protection from Cart

To hide the Order Protection item from the cart display, follow these steps:

  • Navigate to Templates > Pages > cart.html
  • Locate the {{/partial}} tag at the bottom of the file
  • Add the following code just above the {{/partial}} tag:
<script>
  document.addEventListener("DOMContentLoaded", () => {
    const cartItems = document.querySelectorAll("tr.cart-item");

    cartItems.forEach((item) => {
      if (item.innerText.includes("Order Protection")) {
        item.style.display = "none";
      }
    });
  });
</script>
6

Add Claims Section to Order Confirmation Emails

To add a claims section to your order confirmation emails:

  1. Go to Marketing > Transactional Emails in your BigCommerce admin.
  2. Click the next to Order Email and select Edit template.
  3. Set up the following phrases:
Phrase namePhrase value
order_protection_labelIssues with your order?
order_protection_messageLuckily, you purchased Order Protection! Submit a claim to quickly resolve lost, damaged, stolen, or wrong item issues with your order. Once approved, you will receive a refund or reshipment at no additional cost.
order_protection_buttonFile a claim
  1. Scroll to the bottom of the template and paste the following block of code right above <table class=“row”>.
{{#each order.products}}
  {{#if name "==" "Order Protection"}}
    <style>
      .enable_op { display: block !important; }
    </style>
  {{/if}}
{{/each}}

<table
  class="container enable_op"
  style="display: none; width: 100%; margin-top: 30px;"
>
  <tr>
    <td
      style="font-family: Arial, sans-serif; vertical-align: top; padding: 20px; text-align: center; border: 1px solid #ccc; background-color: #f8f9ff; border-radius: 8px;"
    >
      <p
        style="margin-top: 0; margin-bottom: 10px; font-weight: bold; font-size: 16px; color: #000;"
      >
        {{lang "order_protection_label"}}
      </p>
      <p
        style="margin-top: 0; margin-bottom: 20px; font-size: 14px; color: #333; line-height: 1.4;"
      >
        {{lang "order_protection_message"}}
      </p>
      <a
        href="https://claim.orderprotection.com/submitClaim?email={{customer.email}}&op_id={{order.id}}&fromEmail=true"
        style="color: #ffffff; font-weight: bold; font-size: 14px; text-decoration: none; display: inline-block; padding: 15px 25px; background-color: #1991c6; border-radius: 6px; min-width: 280px;"
      >
        {{lang "order_protection_button"}}
      </a>
    </td>
  </tr>
</table>

That’s it! Your customers will now see a clear claims section in their order confirmation emails, making it easy to file a claim if needed.