skip to Main Content

I’m trying to display the product name on top of the "short product description".

I have been told that this can be accomplished by using PHP, which I know nothing of. The only way I can use a PHP function in the desired space is using HTML, which I saw that can be used with:

<div><?php $functiongoeshere();></div>

This is on a wordpress/woocommerce site, you can see a product example by clicking here.

Could someone please help me?

2

Answers


  1. This is not css matter, it’s php, you need to find tpl file that controls single product page.

    In woocommerce its called something like single-product.tpl but theme can affect it.

    find line that echoes title and than you can copy this to another section, in your case description.

    That way every product will display name in description as well

    Login or Signup to reply.
  2. To move product title before product description in single product pages, try to use the following:

    add_action( 'woocommerce_single_product_summary', 'move_single_product_title', 1 );
    function move_single_product_title(){
        remove_action('woocommerce_single_product_summary', 'woocommerce_template_single_title', 5 ); 
        add_action('woocommerce_single_product_summary', 'woocommerce_template_single_title', 15 );
    }
    

    Code goes in functions.php file of your active child theme (or active theme). It should works.

    See: WooCommerce action hooks and overriding templates

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search