IckyArcher
IckyArcher

Reputation: 15

Change WooCommerce single product name location before short description

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?

Upvotes: 1

Views: 771

Answers (2)

LoicTheAztec
LoicTheAztec

Reputation: 254363

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

Upvotes: 2

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

Upvotes: 0

Related Questions