use-rebuy-hooks
v1.1.0
Published
Rebuy integration for Shogun Frontend.
Downloads
3
Readme
Rebuy
Rebuy integration for Shogun Frontend.
Rebuy creates intelligent shopping experience with data-driven persoanlization and providing merchandizing solutions.
Installation
yarn add @frontend-sdk/rebuy
npm install @frontend-sdk/rebuy
Usage
Rebuy Widgets
- Inject Rebuy's script with your shopify domain (myshopify):
import { useRebuyWidget } from '@frontend-sdk/rebuy'
const App = () => {
useRebuyWidget('<insert Shopify domain here>')
return <>…</>
}
- Add
div
with the widget ID:
const RebuyWidget = ({ widgetId }) => {
return (
<div
data-rebuy-id="widgetId"
data-rebuy-shopify-product-ids="<Product ID>"
</div>
)
}
Rebuy Data
- Add
div
with the widget's data source API endpoint (You can find it here: https://rebuyengine.com/data_sources/id//preview):
import { useRebuyData } from '@frontend-sdk/rebuy'
const RebuyWidget = ({ dataSourceUrl }) => {
const rebuyData = useRebuyData('<insert data source URL>')
return (
<div>
{
rebuyData &&
Object.keys(rebuyData).length > 0 &&
<div className="rebuy-widget">
<h1>Rebuy Section</h1>
<div>
{
rebuyData.data.map(each => {
return (
<div> {each.title} </div>
)
})
}
</div>
</div>
}
</div>
)
}
Links
- [Help Center: Installation ] (https://rebuyengine.com/help/docs)