Home > widget-integration > RecommendationService > rebuildProductDataFromShopifyData
RecommendationService.rebuildProductDataFromShopifyData() method
Rebuilds product data from Shopify format to Boost format.
This method transforms Shopify product data structure to match the format expected by the recommendation widget. Can be overridden to customize the overall product transformation logic or add custom product fields.
Signature:
rebuildProductDataFromShopifyData(product: Product$2): Product;
Parameters
|
Parameter |
Type |
Description |
|---|---|---|
|
product |
Product$2 |
Shopify product object containing variants, media, and other product data |
Returns:
Transformed product in Boost format with images_info and processed variants
Example
Override to add custom product fields:
rebuildProductDataFromShopifyData(product: ShopifyProduct): BoostProduct {
const baseProduct = super.rebuildProductDataFromShopifyData(product);
// Add custom fields for this shop
baseProduct.custom_badge = this.getProductBadge(product);
baseProduct.shipping_info = this.getShippingInfo(product);
return baseProduct;
}