Reply To: Woocomerce second title , with custom fields and elements

Home Forums Support Woocomerce second title , with custom fields and elements Reply To: Woocomerce second title , with custom fields and elements

Home Forums Support Woocomerce second title , with custom fields and elements Reply To: Woocomerce second title , with custom fields and elements

#743497
FunkyCss

Hey , what i did finally and it works but i believe is not the best way cause i notice some css brakings small , but visible .

So i made with ACF a custom text field for woocomerce products . then i went to Functions.php and i made two actions there .

1. For the Single Product

add_action( 'woocommerce_single_product_summary', 'display_acf_field_under_title', 6 );

function display_acf_field_under_title() {
echo get_field('subtitle_');
//'subtitle_' is the slug of the ACF
}

2. For the Category of Products

add_action( 'woocommerce_shop_loop_item_title', 'andrew_display_acf_subtitle_on_category_page', 15 );

function andrew_display_acf_subtitle_on_category_page() {
echo get_field('subtitle');
}

* So i am letting this here for the next ones but i would apreciate if there is a way without installing ACF and work with custom fields that wordpress already has , and ELEMENTS.