'Edit product hook WooCommerce
On my product template, I execute this action :
<?php
/**
* woocommerce_single_product_summary hook.
*
* @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
*/
do_action('woocommerce_single_product_summary');
?>
What I want is to edit woocommerce_template_single_excerpt
so I wrote this code in functions.php :
add_action('woocommerce_template_single_excerpt', 'woocommerce_custom_single_excerpt', 20);
function woocommerce_custom_single_excerpt() {
global $post;
echo '<p class="product-description">';
echo $post->post_excerpt;
echo '</p>';
}
But it does not override at all.
Thanks for your help!
Solution 1:[1]
Please try this code snippet.
add_action('woocommerce_single_product_summary', 'woocommerce_custom_single_excerpt', 15);
function woocommerce_custom_single_excerpt() {
global $post;
echo '<p class="product-description">';
echo "hello";
echo '</p>';
}
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|---|
Solution 1 | mujuonly |