All Questions
Tagged with wp-query woocommerce-offtopic
129
questions
0
votes
2
answers
53
views
How to get products with the same custom attribute like ean code
I Try to get all products with the same ean code, but the query doesn't work and also doesn't give any errors. What am I missing?
Here is the code I use.
if (is_product()) {
global $product;
$...
0
votes
1
answer
212
views
How do I display WooCommerce products in my query to rows of 3?
I have created a WooCommerce search plugin. It fetches products, however it only displays the products as one per row.
How can I amend my query to display 3 products per row? Here is the function:
...
0
votes
1
answer
734
views
What is the meta_query key name for the woo product average rating? [closed]
I am asking about meta_query key name to query the woocommerce all product 5 star average rating in wp_query
I have tried to use these names but not working (_wc_average_rating , average_rating, ...
1
vote
1
answer
2k
views
woocommerce search by sku and title ajax
This snippet works only in Title and i need to add also in Metakey SKU.
<?php
// Ajax Search.
function thb_ajax_search() {
check_ajax_referer( 'thb_autocomplete_ajax', 'security' );
$...
0
votes
0
answers
977
views
Tax Query on product_cat using NOT IN as operator does not exclude that category
Using the following code, I expect $items to not include products with the product category "stones." However, that is not the result. It doesn't seem to be excluding that category at all. ...
0
votes
0
answers
208
views
Woocommerce Shortcode which displays a table with product data
I searched for the internet but didnt find anything which works to my use case. I want to have a shortcode which displays a table of products. In each row I want the product to have the following data:...
0
votes
1
answer
138
views
Can't fetch Custom Post Type Data through Custom Query
I have a custom taxonomy "Shade Type" which contains two types
Ready Mix
DCM
I am querying the DCM value to display in WooCommerce tab. My code is fine but I am not getting any values in ...
0
votes
0
answers
231
views
Make a products only viewable to a specific user ID in meta_query pre_get_posts
I need to show some products to specific users set in the product itself by an ACF field that stores the user ID.
I want to hide the product from the product category page / shop completely unless ...
1
vote
1
answer
31
views
Take all produts by category
I don't know why i can't take the products by category name. I get no product found.
The code look like this
<ul class="glide__slides">
<?php
$args = array(
'post_type' ...
1
vote
0
answers
28
views
Sort by price woocommerce by ID post_meta
There is an additional field in Posts (id_product), when using WP_Query I want to sort posts by meta _price (id_product).
How do I do this?
If I try to do so:
$query->set( 'meta_key', '_price' );
...
1
vote
0
answers
360
views
How to get all product attributes for filters in WooCommerce?
I am trying to figure out how WooCommerce decides which product attribute filters to bring. Because it does not only bring filterable attributes of the products in first page of an archive, but also ...
1
vote
0
answers
355
views
Cluster WooCommerce products in each Category Archive by Tags assigned to products
Hello WordPress specialists. I am building my dream shop and I prepared a structure which I can not build now. Can you help me think about it?
I prepared a product_cat categories which are based on ...
0
votes
0
answers
309
views
ElasticPress is (aparently) messing with my search filters
I recently installed ElasticPress on my woocommerce store, and it's working fine -- the product page is showing normally, and the search bar is working fine with the new elastic capabilities. However, ...
2
votes
2
answers
3k
views
Woocommerce returns Product post_status as published even tho it is in status draft
Heyho,
I've got a problem getting the post_status of a WP_PostObject which is a Woocommerce-Product.
I get all products doing this query:
$onlineShopProducts = get_posts([
'post_type' =>...
0
votes
0
answers
380
views
Woocommerce Get Orders By Meta Value
I have orders, some of them has meta value is set 0. Please see my attachment
To filter out orders based on meta value, i am using below code...
add_action( 'pre_get_posts', function( $query ) {
...