E
E
Eugene2017-04-22 11:46:38
WordPress
Eugene, 2017-04-22 11:46:38

How to add "price from..." under each product category name in woocommerce storefront?

Hello! The essence of the question is as follows. There is a woocommerce showcase, you need to make it so that next to each product category name the lowest price of the product in this category is indicated. Maybe there is a plugin? Tell me please. An example of what you want is in the photo.bc6d723d6d7c40b2846a85fbf3631d55.jpg

Answer the question

In order to leave comments, you need to log in

2 answer(s)
W
WordPress WooCommerce, 2017-04-22
@maxxannik

1. write a function that will update the price_min metafield for each category
2. write a handler that will massively run through all categories and pull this function
3. add this function to the hook for changing the price metafield of the product
4. change the category output template, add price_min metafield output

Y
Yuri, 2017-04-25
@klyo

Everything in WooCommerce is based on hooks. The full list of hooks can be found here: WooCommerce Hooks .
For example, we take the filter "woocommerce_cart_product_price":

add_filter( 'woocommerce_cart_product_price', 'my_pricetext_for_cat' );

function my_pricetext_for_cat(  $product_price ) {
    // Здесь ваш код
    return  "Цена от: ".$product_price;
}

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question