Lightweight package providing a pre-configured, yet filterable
WP_Queryextension for top selling products.
NOTE: This repository is no longer maintained.
This package comes with a WP_Query extension that allows for querying top selling products.
By default, there is no definition as to when a product is a top seller, though.
This can either be done by passing according query arguments, or filtering the given or default ones.
$ composer require inpsyde/top-selling-products:~1.0
Run the tests:
$ vendor/bin/phpunit
This package requires PHP 5.4 or higher.
This hook allows to filter the query arguments.
Arguments:
array$args: Query arguments.
<?php
add_filter( 'inpsyde_top_selling_products.query_args' , function( array $args ) {
// Randomize the results, but exclude posts with specific IDs.
return array_merge( $args, [
'post__not_in' => [ 4, 8, 15, 16, 23, 42 ],
'orderby' => 'rand',
] );
} );Copyright (c) 2016 Inpsyde GmbH, Thorsten Frommen
This code is licensed under this License.