Questions tagged [taxonomy-terms]

Terms are usually associated to custom taxonomies in Wordpress

Use this tag if you mean terms used for custom taxonomies in Wordpress

486 questions
2
votes
1 answer

Remove out of stock products from WooCommerce related products custom WP query

hello I want to show related products based on my custom query but I just want to show 'in_stocks' products and meta_query not working with tax_query. anyone can help me? $query_args = array( 'posts_per_page' => 10, 'no_found_rows' => 1, …
2
votes
1 answer

List main product subcategories of a product category in WooCommerce

I have a category of WooCommerce products called "Product Types", and I'm trying to list all the categories underneath that, but NOT the child categories of those categories. For example, I have: Product Types Carbide Milles Fishing Tools Child…
2
votes
1 answer

How to change sorting in a list of product tags for WooCommerce products

I use this function to get and display all tag for each product : public function get_product_tags_list() { global $product; if ( ! is_a( $product, 'WC_Product' ) ) { return; } …
steph66
  • 57
  • 6
2
votes
1 answer

Wordpress: Output list with taxonomy term IDs in WP_Query loop

I would like to output in a WP_Query loop a list with the term IDs of a certain taxonomy ('genre') of the respective post. I managed to output the first ID (as you can see in the code example). How can I get a comma separated list of all term IDs of…
RaWa
  • 25
  • 5
2
votes
1 answer

Checkbox enabling a percentage discount in WooCommerce Checkout for specific category

The amended code below is based on Add a checkout checkbox field that enable a percentage fee in Woocommerce. I have adapted but wishing to only target a specific category so when a student ticks the box at checkout, defining they are a student, it…
Herbivore
  • 23
  • 4
2
votes
1 answer

Get products with specific attribute term and specific category term in Woocommerce using SQL

I wish to find products with two different criteria. The code I used first to search one criteria is; SELECT rel.object_id, rel.term_taxonomy_id, tt.taxonomy, tt.term_id, ts.name FROM df1wrmw_term_taxonomy tt INNER JOIN df1wrmw_term_relationships…
2
votes
1 answer

WooCommerce - How to hide product tags in the tag cloud when it has no 'in stock' products

I have a WooCommerce site and need product tags to be hidden from the product tag cloud when a product tag archive page has 0 'in stock' products available. The code below shows my current progress and I will update as more progress is made. I…
2
votes
1 answer

How to add a category programmatically to a WooCommerce product?

In WooCommerce, if an item is sold out, I would like to add a category "sold out" to it, so that I can show these items in a separate section. I created the "sold out" category in the WooCommerce/WordPress Admin panel. This is what I have in my…
Cinder
  • 319
  • 2
  • 15
2
votes
2 answers

Get a list of siblings term ids from current product category in WooCommerce

I want to retrieve a list of term Ids based on the current category ID. At the moment I'm using the following code: $product_cat_items = get_queried_object(); $product_cat_id = $product_cat_items->term_id; $product_cat_child =…
Cray
  • 5,307
  • 11
  • 70
  • 166
2
votes
1 answer

Custom WooCommerce endpoint with dynamic value is not working

I wanted to make a new endpoint for WooCommerce with dynamic value. Unfortunately I got rest_no_route error. This is the code (plugin):
2
votes
1 answer

Display sub subcategories terms list on WooCommerce subcategory archive pages

In Woocommerce I use Get the subcategories of the current product category in Woocommerce archives answer function, to display a list of subcategories on the parent category pages But I only need to apply this to SPECIFIC product-categories though,…
2
votes
1 answer

Saving product attributes with Woocommerce methods not syncing to front end

This is not a duplicate question. The problem here is not adding the attributes per say. The problem is associating the added attribute options with the proper terms I guess. As can be seen in the pictures below, the attribute options are set…
Hantu
  • 154
  • 1
  • 13
2
votes
2 answers

Auto add product to cart except for some WooCommerce product categories

I am using Auto add a product for cart item from specific product categories in WooCommerce answer code to auto add a free product to the cart. The code works great if the product is in a specific category but I need to add the product if it is NOT…
Junky
  • 958
  • 7
  • 17
2
votes
1 answer

Filter WooCommerce orders by shop manager based on assigned taxonomy terms

I would like to assign orders with specific product tags to a specific store manager in the backend and hide the rest of the orders. I am currently using Order Splitter for WooCommerce free plugin to split orders into separate orders by item…
2
votes
1 answer

Get product category and tag terms as meta keyword in WooCommerce

I have been using below code for using Tags & categories as META Keywords for my wordpress posts. function wcs_add_meta_keywords() { global $post; if ( is_single() ) { $cats = get_the_category( $post->ID ); $tags = get_the_tags( $post->ID…
kandav
  • 75
  • 1
  • 9