-
Notifications
You must be signed in to change notification settings - Fork 10.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Search argument in WC_Product_Query и wc_get_products? And Args can be applied to variations? #21450
Comments
Hi there, You can use
Hope this clears things up. Thanks. |
For anyone else (and likely myself while googling this problem again) who needs a more straightforward resolution to this problem feel free to use the following code snippets.
|
Sorry! In retrospect that wasn't a super helpful response because the line I linked to now points to a different thing. :) Thanks for adding the snippet. For reference, this is what my recommendation looks like as a snippet:
|
We can't use order id as the search term. It will return zero result. |
This code is a part of my custom search endpoint, its results are similar to woocommerce REST API endpoint
|
Thanks past me |
Describe the question
Is there any way to use search by product title or custom meta with new functions? because with wp_query we can use it like that:
$query = new WP_Query( array( 's' => 'keyword' ) );
or like alternative we can get products with wp_query and add ids to include
For example if we create ajax search with fields: search, date range, sku, price, etc
Search Ids by s field if we get it earlier...
PS Change from WP_Query doesn't make sense because all attributes like tags, categories, price, sku etc don't work with variations, only for parent products.
The text was updated successfully, but these errors were encountered: