remove_action('woocommerce_shop_loop_item_title','woocommerce_template_loop_product_title',10);
add_action('woocommerce_shop_loop_item_title','fun',10);
function fun()
{
echo 'custom_field_value';
}
Note: I want to replace the title on shop page with custom field value. The code is correct but the echo part I need help on it.
remove_action('woocommerce_shop_loop_item_title','woocommerce_template_loop_product_title',10);
add_action('woocommerce_shop_loop_item_title','fun',10);
function fun()
{
echo 'custom_field_value';
}
Note: I want to replace the title on shop page with custom field value. The code is correct but the echo part I need help on it.
Share Improve this question edited Dec 11, 2018 at 10:17 Pratik Patel 1,1091 gold badge11 silver badges23 bronze badges asked Dec 11, 2018 at 3:25 Joseph PausalJoseph Pausal 1 1- try this code :if (is_shop()){ echo 'custom_field_value'; } – vikrant zilpe Commented Dec 11, 2018 at 14:15
2 Answers
Reset to default 0woocommerce_shop_loop_item_title
is not the right hook to change the title on shop page.
Try this instead:
add_filter( 'woocommerce_page_title', function() {
echo 'custom_field_value';
} );
I need help on this section only since the code I have provided is 100% working to remove the title.
echo 'custom_field_value';
If I will call custom field as custom_title how can I show this?