Answer the question
In order to leave comments, you need to log in
New information in Woocommerce product card?
Hello.
There is a page with Woocommerce products. How to add some new block in the product card and on the product page?
I know that this is done by hooks, for example through woocommerce_single_product_summary, but in this case, the information is added after the entire container. How to do to display the information valid after the price?
Thank you.
Answer the question
In order to leave comments, you need to log in
All Woocommerce templates are stored in the plugin folder in templates. All these templates are named so that you can guess what they are responsible for. You can override each of these templates in your theme and change as you like, as written in each file:
<?php
/**
* The template for displaying product content in the single-product.php template
*
* This template can be overridden by copying it to yourtheme/woocommerce/content-single-product.php.
*
/templates/content-single-product.php
<div class="summary entry-summary">
<?php
/**
* Hook: woocommerce_single_product_summary.
*
* @hooked woocommerce_template_single_title - 5
* @hooked woocommerce_template_single_rating - 10
* @hooked woocommerce_template_single_price - 10
* @hooked woocommerce_template_single_excerpt - 20
* @hooked woocommerce_template_single_add_to_cart - 30
* @hooked woocommerce_template_single_meta - 40
* @hooked woocommerce_template_single_sharing - 50
* @hooked WC_Structured_Data::generate_product_data() - 60
*/
do_action( 'woocommerce_single_product_summary' );
?>
</div>
remove_action('woocommerce_single_product_summary', 'woocommerce_template_single_price', 10);
remove_action('woocommerce_single_product_summary', 'woocommerce_template_single_excerpt', 20);
add_action('woocommerce_single_product_summary', 'woocommerce_template_single_excerpt', 10);
add_action('woocommerce_single_product_summary', 'woocommerce_template_single_price', 20);
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question