Skip to content
This repository has been archived by the owner. It is now read-only.
master
Switch branches/tags
Go to file
Code

Latest commit

 

Git stats

Files

Permalink
Failed to load latest commit information.
Type
Name
Latest commit message
Commit time
 
 
src
 
 
 
 
 
 
 
 
 
 
 
 
 
 

README.md

Top Selling Products

Latest Stable Version Project Status Build Status Total Downloads

Lightweight package providing a pre-configured, yet filterable WP_Query extension for top selling products.

UNMAINTAINED

NOTE: This repository is no longer maintained.

Introduction

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.

Installation

$ composer require inpsyde/top-selling-products:~1.0

Run the tests:

$ vendor/bin/phpunit

Requirements

This package requires PHP 5.4 or higher.

Usage

Filters

inpsyde_top_selling_products.query_args

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',
	] );
} );

License

Copyright (c) 2016 Inpsyde GmbH, Thorsten Frommen

This code is licensed under this License.

About

Lightweight package providing a pre-configured, yet filterable WP_Query extension for top selling products.

Resources

License

Languages