Answer the question
In order to leave comments, you need to log in
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.
Answer the question
In order to leave comments, you need to log in
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
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 questionAsk a Question
731 491 924 answers to any question