custom-taxonomy

Display specific custom product attributes on single product pages in Woocommerce

白昼怎懂夜的黑 提交于 2021-01-28 06:42:29
问题 I found the following code to display all custom attributes on a product detail page (with a specific bar-style design that I need). The code works like a charm and I have the proper CSS to display horizontal bars of my custom attributes. Problem I have is that I only want to display specific named attributes and don't know how to change the loop to do that... function isa_woocommerce_all_pa(){ global $product; $attributes = $product->get_attributes(); if ( ! $attributes ) { return; } $out =

How to change value for 'options' and 'select' in wp_dropdown_categories?

∥☆過路亽.° 提交于 2021-01-28 06:08:40
问题 I am currently using this code to display only the child terms of the current category being viewed - <?php //first get the current term $current_term = get_term_by( 'slug', get_query_var( 'term' ), get_query_var( 'taxonomy' ) ); //then set the args for wp_dropdown_categories $args = array( 'child_of' => $current_term->term_id, 'taxonomy' => $current_term->taxonomy, 'hide_empty' => 0, 'hierarchical' => true, 'depth' => 2, 'title_li' => '', 'show_option_all' => All, 'hide_if_empty' => true );

Get all “active” attributes taxonomies attached to products in WooCommerce?

陌路散爱 提交于 2021-01-28 05:38:40
问题 I want to get all "active" attributes list that attached to the products, so if the attribute exists, but don't attach to any products don't display. I can display all attributes as dropdown like this: $attributes = wc_get_attribute_taxonomies(); if($attributes) { echo '<select name="all-attributes" id="all-attributes">'; foreach ( $attributes as $attribute ) { echo '<option value="' . $attribute->attribute_name . '">' . $attribute->attribute_label . '</option>'; } echo '</select>'; } But

Set a minimum quantity for cart items from specific WooCommerce product category

久未见 提交于 2021-01-28 05:10:47
问题 In WooCommerce, I am trying to set a minimum quantity for cart items from a specific product category. Based on "Minimum cart item quantity for a specific product category in WooCommerce", here is my code attempt : add_action( 'woocommerce_check_cart_items', 'wc_min_item_required_qty' ); function wc_min_item_required_qty() { $category = 'games'; // The targeted product category $min_item_qty = 4; // Minimum Qty required (for each item) $display_error = false; // Initializing // Loop through

Get the product category name and description in Woocommerce Single Product page

爱⌒轻易说出口 提交于 2021-01-28 04:39:54
问题 I've been using the WooCommerce Codex, but I can't seem to get the data to display. I simply want to display the product category and descriptions to display on single product pages for my own custom layout like so. <?php global $product; echo $product->get_attributes; ?> <?php global $product; echo $product->get_short_description; ?> 回答1: As you can have many product categories for a product, you will need to use a foreach loop. The $term variable is the WP_Term object… <?php foreach( wp_get

Display a custom taxonomy in Woocommerce single product pages

我的未来我决定 提交于 2021-01-28 03:10:15
问题 I have added a new taxonomy called "Vendor" to Woocommerce with the following code: // hook into the init action and call taxonomy when it fires add_action( 'init', 'create_vendor_taxonomy', 0 ); // create and register vendor taxonomy (hierarchical) function create_vendor_taxonomy() { $labels = array( 'name' => _x( 'Vendors', 'taxonomy general name', 'textdomain' ), 'singular_name' => _x( 'Vendor', 'taxonomy singular name', 'textdomain' ), 'search_items' => __( 'Search Vendors', 'textdomain'

Display variations attributes values as separate rows in Woocommerce cart / checkout

倖福魔咒の 提交于 2021-01-27 13:58:55
问题 I have several variable products on our https://alcocovers.com/shop/ The issue I am facing is: upon adding to the cart, Dumpster Tarps has item data listed on cart page, but product Lugger Cover doesn't. Here's a screenshot: I thought there was some issue in the cart item data template I am using on the website, but I checked and nothing is broken (for reference here's the template code https://pastebin.com/fswKRZ8a ). I disabled all custom templates and the results were the same. I also

Get the subcategories of the current product category in Woocommerce archives [closed]

喜夏-厌秋 提交于 2020-12-13 03:18:13
问题 Closed . This question needs to be more focused. It is not currently accepting answers. Want to improve this question? Update the question so it focuses on one problem only by editing this post. Closed last year . Improve this question I'm trying to Show subcategories (not subsubcategories,etc) under current category in Woocommerce like this Web: http://www.qs-adhesivos.es/app/productos/productos.asp?idioma=en For Example, Construction is the category, and Sealants & adhesives, waterproofing,

Get the subcategories of the current product category in Woocommerce archives [closed]

萝らか妹 提交于 2020-12-13 03:16:17
问题 Closed . This question needs to be more focused. It is not currently accepting answers. Want to improve this question? Update the question so it focuses on one problem only by editing this post. Closed last year . Improve this question I'm trying to Show subcategories (not subsubcategories,etc) under current category in Woocommerce like this Web: http://www.qs-adhesivos.es/app/productos/productos.asp?idioma=en For Example, Construction is the category, and Sealants & adhesives, waterproofing,