Product Recommendations JavaScript SDK
📚 JavaScript library for retrieving and displaying product recommendations.
📦 Installation
This SDK can be pulled down from a CDN or installed as a module from NPM.
CDN
The latest version of the SDK is placed in the latest
directory.
<script src="https://sdk.magento-datasolutions.com/latest/index.js"></script>
Specific versions are also published on the CDN under their respective directories.
<script src="https://sdk.magento-datasolutions.com/v0.0.24/index.js"></script>
NPM
npm install @magento/recommendations-js-sdk
🥑 Usage
import RecommendationsClient from "@magento/recommendations-js-sdk"
const client = new RecommendationsClient()
client.register({
name: "people also viewed",
type: "people also viewed",
})
const {status, data} = await client.fetch({
currentSku: "134524",
})
const markup = client.render({
unit: data.units[0],
})
❓ Questions
If you have questions or need help, there are a few ways you can get in touch.
📧 Email us at magento-product-recs-feedback@adobe.com
💬 Find me (@garropy
) in the Magento Commerce Engineering Slack workspace
🐞 Open an issue in the repository