Top 5 Products Frequently Bought Together
- Lightning Web Component showing frequently bought together products.
- Flow Action available to return the top 5 frequently bought products.
- Works only with Order Products for now.
- Managed Package Version.
- Get Apex Docs To Work.
- Remove Content Assets from the Package.
- Enable For Opportunity Products.
- Enable for CPQ Quote Line Products.
- Units Tests for LWC.
- Enable additional file types (other than .jpq).
- Custom Object to hold the top 5 related products.
- Scheduled Batch Job to maintain the top 5 related products every night.
- Image resizing functionality.
- Completely custom build the carousel component. (Salesforce's is a bit limited, and hard to change).
After deployment, assign permission set Related Products Viewer
to users. Provides access to view the lightning component.
Images need to be sized into the dimensions you require. Recommended is 240x320.
Images need to be uploaded as Content Assets.
The name of the Content Asset must match the Product Code that you want the image to display for.
In your Flow you must input a single Product2 record Id. The top 5 most frequently bought products to the input Product will be returned as a list of Products.
You can call the class through Apex:
List<FrequentlyBoughtTogether.request> rqts = new List<FrequentlyBoughtTogether.request>();FrequentlyBoughtTogether.request rqt = new FrequentlyBoughtTogether.request();
rqt.Product2Id = product2Id;
rqts.add(rqt);
List<FrequentlyBoughtTogether.Result> rslts = FrequentlyBoughtTogether.freqProds(rqts);
List<Product2> rsltsProducts = rslts[0].frequentProducts;