Product recommendations
obsolete: check how this is referenced now
SALVO-TS supports Shopify's Product Recommendations API.
If you link to a recommended product, make sure you use the url attribute on the returned product - this will let Shopify track the conversion for reporting purposes.
Get recommendations
tsconst res = await recommendations.recommend({productId: 1234567890, // requiredlimit: 10, // optional, max 10});// -> {// products: [// // List of Shopify product objects// ]// }
tsconst res = await recommendations.recommend({productId: 1234567890, // requiredlimit: 10, // optional, max 10});// -> {// products: [// // List of Shopify product objects// ]// }
Get recommendations & add or replace a new section
Insert a new section:
tsawait recommendations.recommend({productId: 1234567890, // requiredlimit: 10, // optional, max 10section: {id: 'product-recommendations',after: 'header',}});
tsawait recommendations.recommend({productId: 1234567890, // requiredlimit: 10, // optional, max 10section: {id: 'product-recommendations',after: 'header',}});
Replace an existing section:
tsawait recommendations.recommend({productId: 1234567890, // requiredlimit: 10, // optional, max 10section: {id: 'product-recommendations',replace: 'product-recommendations',}});
tsawait recommendations.recommend({productId: 1234567890, // requiredlimit: 10, // optional, max 10section: {id: 'product-recommendations',replace: 'product-recommendations',}});
Render a section and get the raw section HTML:
tsconst sectionHtml = await recommendations.recommend({productId: 1234567890, // requiredlimit: 10, // optional, max 10section: {id: 'product-recommendations',raw: true}});
tsconst sectionHtml = await recommendations.recommend({productId: 1234567890, // requiredlimit: 10, // optional, max 10section: {id: 'product-recommendations',raw: true}});