taxonomy-terms

Display description before the title in WooCommerce product category archives

你离开我真会死。 提交于 2021-02-19 08:50:53
问题 In WooCommerce, I am trying to display the description before the title in Product category archive pages. But I fail trying to find out what hooks could I use to do it. The idea was to have a "Flavour Menu" be displayed first, and then the title afterwards, like in this screenshot: Any track is appreciated. 回答1: You will need to override the template templates/archive-product.php located in the Woocommerce plugin, copying it to your active theme folder to a woocommerce subfolder (but not in

Hide a variation attribute value in Woocommerce variable product dropdown

泪湿孤枕 提交于 2021-02-16 20:14:34
问题 I want to hide specific variations from being shown in the dropdown of woocommerce product pages. I was able to hide the "choose an option" but I am struggling with doing the same for the value="2,5 kg" for example This is my code for hiding "choose an option": add_filter( 'woocommerce_dropdown_variation_attribute_options_html', 'remove_choose_an_option'); function remove_choose_an_option( $html ){ $html = str_replace('<option value="">' . __( 'Choose an option', 'woocommerce' ) . '</option>'

Sort specific product category cart items at the end in WooCommerce

血红的双手。 提交于 2021-02-10 05:48:07
问题 How to sort items from a defined product category to be at the end of a cart order, for example I want all products that belong to a product category 'bottle' to be at the end of the cart order. I have found this code that sorts by price, but would like to adjust to as described above. add_action( 'woocommerce_cart_loaded_from_session', 'prefix_cart_order_prod_cat' ); function prefix_cart_order_prod_cat() { $products_in_cart = array(); // Assign each product's price to its cart item key (to

Sort specific product category cart items at the end in WooCommerce

我的梦境 提交于 2021-02-10 05:48:07
问题 How to sort items from a defined product category to be at the end of a cart order, for example I want all products that belong to a product category 'bottle' to be at the end of the cart order. I have found this code that sorts by price, but would like to adjust to as described above. add_action( 'woocommerce_cart_loaded_from_session', 'prefix_cart_order_prod_cat' ); function prefix_cart_order_prod_cat() { $products_in_cart = array(); // Assign each product's price to its cart item key (to

wp_list_categories() - display first level categories and only current term's children in subcategory page

人盡茶涼 提交于 2021-02-08 03:58:13
问题 I'm using WordPress. Have multiple categories with its subcategories. In general page, I'm displaying all first level categories. Here is my code: $args = array( 'type' => 'product-items', 'child_of' => 0, 'parent' => '', 'order' => 'DESC', 'hide_empty' => 0, 'hierarchical' => 1, 'exclude' => '', 'include' => '', 'number' => '', 'taxonomy' => 'product-category', 'pad_counts' => false, 'depth' => 1, 'title_li' => '' ); wp_list_categories($args); Once you click and go inside a first level

Minimum cart amount for specific product categories in WooCommerce

我的梦境 提交于 2021-02-01 05:13:47
问题 In WooCommerce I use an OUTLET category with on sale products and I would like to set a minimum subtotal (30 €) for customers purchasing any "Outlet" product. I tried to hook into woocommerce_after_calculate_totals to: check cart items for a specific product category display a notice when a specific product category is found and the order is lower than 30 € and eventually redirect to cart page when user tries to checkout with an order lower than 30 €. Here is my code: add_action( 'woocommerce

Minimum cart amount for specific product categories in WooCommerce

痞子三分冷 提交于 2021-02-01 05:13:34
问题 In WooCommerce I use an OUTLET category with on sale products and I would like to set a minimum subtotal (30 €) for customers purchasing any "Outlet" product. I tried to hook into woocommerce_after_calculate_totals to: check cart items for a specific product category display a notice when a specific product category is found and the order is lower than 30 € and eventually redirect to cart page when user tries to checkout with an order lower than 30 €. Here is my code: add_action( 'woocommerce

Sort WooCommerce product category sub menu items by name ASC in Wordpress menu

做~自己de王妃 提交于 2021-01-28 21:32:58
问题 I am adding in my main WordPress menu to WooCommerce product category menu items, the children subcategory terms as submenu items with the following code and it works. The code: add_filter("wp_get_nav_menu_items", function ($items, $menu, $args) { // don't add child categories in administration of menus if (is_admin()) { return $items; } foreach ($items as $index => $i) { if ("product_cat" !== $i->object) { continue; } $term_children = get_term_children($i->object_id, "product_cat"); // add

How to get all products from current WooCommerce product category?

时光怂恿深爱的人放手 提交于 2021-01-28 21:18:23
问题 Customizing my archive-product.php . How can I show only products within a certain category in a custom loop? This similar question, didn't solve my problem. I tried single_cat_title() to get the current category based on this question but got an error. I think I need to use get_queried_object() based on this documentation but I keep getting errors. I tried this: <?php $category = single_cat_title('', false); // this returns your current category ?> <?php // Setup your custom query $args =

How to get all products from current WooCommerce product category?

别来无恙 提交于 2021-01-28 20:32:58
问题 Customizing my archive-product.php . How can I show only products within a certain category in a custom loop? This similar question, didn't solve my problem. I tried single_cat_title() to get the current category based on this question but got an error. I think I need to use get_queried_object() based on this documentation but I keep getting errors. I tried this: <?php $category = single_cat_title('', false); // this returns your current category ?> <?php // Setup your custom query $args =