When you install Better Recommendations for Shopify, we'll ask for permissions to access your store's order history. Our recommendation engine uses the purchase history to calculate which items people have bought together.
We count items that a given customer has bought either in the same basket, or across multiple orders. So if a customer buys item A today, and item B next week, that will contribute to the similarity score between items A and B even though they weren't bought in the same order. And if lots of people who buy item A also buy item B, then it becomes likely that we'll recommend item B on the product page for item A.
The algorithm itself is based on cosine similarity.