0
  • Wordpress 5.0.1.
  • Woocommerce 3.5.2

I am building a Wordpress/Woocommerce based Shop page and want to change the standard woocommerce theme logic especially on the Product Page:

More specifically I want to add a Product Subtitle which should be displayed right after the Product Title. The Product Subtitle should be editable as input field via the standard Woocommerce Product Editor.

To Achieve this i am currently using the "WooCommerce Product Subtitle" Plugin https://de.wordpress.org/plugins/wc-product-subtitle/

Beforehand I have already altered the woocommerce product template hooks so that certain elements on the page are displayed in a different order.

In my functions.php i have written:

remove_action( 'woocommerce_single_product_summary', 'woocommerce_template_single_excerpt', 20 );
remove_action( 'woocommerce_before_single_product_summary', 'woocommerce_show_product_images', 20 );
remove_action( 'woocommerce_after_single_product_summary', 'woocommerce_output_product_data_tabs', 10 );
remove_action( 'woocommerce_after_single_product_summary', 'woocommerce_output_related_products', 20 );
remove_action( 'woocommerce_single_product_summary', 'woocommerce_template_single_title', 5 );          
remove_action( 'woocommerce_single_product_summary', 'WooCommerce_Product_Subtitle' );          
remove_action( 'woocommerce_single_product_summary', 'woocommerce_template_single_price', 10 );         
remove_action( 'woocommerce_single_product_summary', 'woocommerce_template_single_add_to_cart', 30 );
remove_action( 'woocommerce_single_product_summary', 'woocommerce_template_single_meta', 40 );          
add_action( 'woocommerce_before_single_product_summary', 'woocommerce_template_single_title', 0 );          
add_action( 'woocommerce_before_single_product_summary', 'woocommerce_template_single_price', 2 );          
add_action( 'woocommerce_single_product_summary', 'woocommerce_show_product_images', 0 );           
add_action( 'woocommerce_single_product_summary', 'woocommerce_template_single_add_to_cart', 1 );           
add_action( 'woocommerce_single_product_summary', 'woocommerce_template_single_meta', 2 );          
add_action( 'woocommerce_single_product_summary', 'the_content', 20 );

As i have changed the order of the Product Title:

remove_action( 'woocommerce_single_product_summary', 'woocommerce_template_single_title', 5 );  
add_action( 'woocommerce_before_single_product_summary', 'woocommerce_template_single_title', 0 );

I need the Subtitle to reflect the changes. The problem I have is that the Product Subtitle is not displayed at the position i want it to show. At the moment the subtitle is displayed after the removed product title and not after the newly added one

I don't quite understand how to add_action or remove_action for the Subtitle or where to find the corresponding hooks/actions/classes.

Help would be greatly appreciated!!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.