Rebuy

Rebuy integration for Shogun Frontend.

Rebuy creates intelligent shopping experience with data-driven persoanlization and providing merchandizing solutions.

⚠️ This package runs on Shogun Frontend and is in customer Beta. It might not currently support all ecommerce platforms or cover all use cases.

Rebuy website →

Installation

yarn add @frontend-sdk/rebuy

npm install @frontend-sdk/rebuy


Rebuy Widgets

Inject Rebuy's script with your Shopify domain (….myshopify.com):

import { useRebuyWidget } from '@frontend-sdk/rebuy'

const RebuyWidget = ({ widgetId }) => {
  useRebuyWidget('<insert Shopify domain>')

  return (
    <div
      data-rebuy-id="widgetId"
      data-rebuy-shopify-product-ids="<Product ID>"
    </div>
  )
}

Rebuy Data

You can also manually display data from any of Rebuy's API endpoints.

import { useRebuyData } from '@frontend-sdk/rebuy'

const RebuyData = () => {
  const { loading, error, data } = useRebuyData('<endpoint>')

  if (loading) {
    return <h1>Loading…</h1>
  }
  if (typeof error !== 'undefined') {
    return <h1>Error</h1>
  }
  if (typeof data === 'undefined') {
    return <h1>Wrong data</h1>
  }

  return (
    <>
      <ul>
        {data.data.map((product) => (
          <li key={product.title}>{product.title}</li>
        ))}
      </ul>
    </>
  )
}

Links


Did this page help you?