Retrieving Models – Building Queries

[ad_1]

Hey!

I’m trying to use the php models to retreive products, purchases, checkouts, subscriptions, etc.

The models ‘all’ method seems to work perfectly fine. However, when attempting to query using the ‘where’ method the result is still every object (i.e. it’s not queried and filtered).

The only query that does in fact work as far as I can see is the example provided in your documentation (product – archived – true/false).

I can’t determine what I’m doing wrong if I am.

I’ve considered that potentially not everything in the object is querable so I checked your REST API reference and used only the query params set out (e.g. checkout – cutomer_ids). In that example I tried both customer and customer_ids as the key, both of which didn’t filter the output.

I know I can filter the output after the fact to get what I need, but it would be great if I could get this working so I don’t have to retreive all objects as this could be quite a large number when, after it’s filtered, might only result in 1 or 2 entries.

Thanks
Matt

 

This site will teach you how to build a WordPress website for beginners. We will cover everything from installing WordPress to adding pages, posts, and images to your site. You will learn how to customize your site with themes and plugins, as well as how to market your site online.

Buy WordPress Transfer