function is not working.
-
I have installed woocommerce. I want to override the woocommerce function.
1-i have my child theme.
2- I added functions.php file
3- i added my function like below[ Moderator note: code fixed. Please wrap code in the backtick character or use the code button. ]
add_filter(‘woocommerce_cart_totals_order_total_html’,’test_func’);
function test_func() {
$value = ‘Test’ . WC()->cart->get_total() . ‘ ‘;
return $value;
}
4- I have copied woocommerce theme in my child theme
5- I call my new function like below<tr class=”order-total”>
<th><?php _e( ‘Total’, ‘woocommerce’ ); ?></th>
<td data-title=”<?php esc_attr_e( ‘Total’, ‘woocommerce’ ); ?>”>
<?php test_func(); ?>
</td>
</tr>
6- But i gave my errorFatal error: Call to undefined function test_func()
- The topic ‘function is not working.’ is closed to new replies.