Note: The following does not work with Advanced Inventory Manger custom fields. This ability is for regular system fields only.
The shortcode allows you to “chain” or “link” various attributes as well. This is very powerful. For example, if we had a car dealership website, we could list out a specific make and model like so:
[wpinventory make="Chevy" model="Tahoe"]
Lets take it a step further, and add the specific year of Tahoe’s we want to display:
[wpinventory make="Chevy" model="Tahoe" year="2017"]
And, we can even take it a step further using the new custom “where” clause. So, if you wanted to showcase certain Tahoes that fall under a certain price, you could do:
[wpinventory make="Chevy" model="Tahoe" year="2017" where="price >= 20000"]
That would tell whatever page you have that shortcode on to output the 2017 Chevy Tahoes that are greater than $20,000.00.
Lets take it another step. Lets say you want all the 2017 Chevy Tahoes that are above $5000.00, but you only want to display them if the quantity you have on hand is above a certain amount (that way you know you never truly run out and have a few at the dealership):
[wpinventory make="Chevy" model="Tahoe" year="2017" where="price > 5000 AND quantity >= 3"]
That would output all 2017 Chevy Tahoes that cost $5000.00 or more and are not below the quantity of three. Meaning there are at a minimum of three of them on the lot.
Lastly, is the absolute power of the “where” clause. It is essentially allow you to write your own SQL queries. If you don’t know what those are, then you may not want to attempt to use it. It can throw an error, if the query is not correct. So, if you do try to use the where clause, then make sure your page is loading the inventory as desired. Now, with all that being said, the power of the “where” clause all by itself could do what we did above if we just wrote it as:
[wpinventory where="make='Chevy' AND model='Tahoe' AND year='2017' AND price > 5000 AND quantity >= 3"]
The above shortcode uses single quotes to surround the value you are checking for and it is all inside of the where clause. There are many many things you can do with this functionality if you are knowledgeable with SQL.