Best Sellers
Track and query best selling products/variants for any time period.
Bonus: quickly see basic ecommerce reporting data.
Usage
Twig
# product's total sales (all time)
{{ craft.bestsellers.productTotalSales(product.id) }}
# product's total sales (last 2 weeks)
{{ craft.bestsellers.productTotalSales(product.id, '2 weeks ago') }}
# variant's total sales (all time)
{{ craft.bestsellers.variantTotalSales(product.defaultVariant.id) }}
# variant's total sales (specific date range)
{{ craft.bestsellers.variantTotalSales(product.defaultVariant.id, '2023-01-01', '2023-03-01') }}
PHP
use fostercommerce\bestsellers\variables\BestSellersVariable;
$bestSellers = new BestSellersVariable();
// product's total sales (all time)
$productSales = $bestSellers->productTotalSales($product->id);
// product's total sales (last 2 months)
$productSales = $bestSellers->productTotalSales($product->id, '2 months ago');
// variant's total sales (all time)
$variantSales = $bestSellers->variantTotalSales($product->defaultVariant->id);
// variant's total sales (specific date range)
$variantSales = $bestSellers->variantTotalSales($product->defaultVariant->id, '2023-01-01', '2023-03-01');
Console Command to process existing orders
php craft best-sellers/backfill
Standard
Plus $97/year after one year.
Installation Instructions
To install this plugin, copy the command above to your terminal.
Reviews
This plugin doesn't have any reviews.
Active Installs
3
License
Craft
Last release
March 29, 2025
Activity (30 days)
0
Closed Issues
1
Open Issues
0
Merged PRs
0
Open PRs