4

I've used the first option of this hook (the other ones didn't work) -> Woocommerce Product Default Description for All Products

And this is how it looks (the red marked text is the standard description)

However, I want the text to appear after the product description. where the red arrow is, I want the standard text. So above 'in winkelmand' (which means 'add to bag')

How can I achieve this?

LoicTheAztec
  • 229,944
  • 23
  • 356
  • 399
Lianne
  • 41
  • 1
  • 2
  • I don't understand what to delete and what to replace.... this is how it now looks: // define the woocommerce_single_product_summary callback function function my_custom_action() { echo '

    Heb je een vraag over dit product? Neem gerust contact op met de klantenservice, stuur een privé berichtje via Facebook of klik op de chat rechts onder.

    '; }; add_action( 'woocommerce_single_product_summary', 'my_custom_action', 15 );
    – Lianne Jul 18 '18 at 13:27

2 Answers2

5

That one did not work for me either, so I kept looking and found this one, which worked perfectly

// Move Description to Under Price WooCommerce

    function woocommerce_template_product_description() {wc_get_template( 'single-product/tabs/description.php' );}

    add_action( 'woocommerce_single_product_summary', 'woocommerce_template_product_description', 20 );
LadyLuck
  • 53
  • 1
  • 7
4

This can be done with the following code (commented):

// 1. Remove the description product tab
add_filter( 'woocommerce_product_tabs', 'remove_descrip_product_tab', 98 );
function remove_descrip_product_tab( $tabs ) {
    // Remove the description tab
    unset( $tabs['description'] );

    return $tabs;
}

// 2. Add the product description after the product short description
add_action( 'woocommerce_single_product_summary', 'my_custom_action', 25 );
function my_custom_action() {
    global $post;

    // Product description output
    echo '<div class="product-post-content">' . the_content() . '</div>';
}

Code goes in function.php file of your active child theme (or active theme). Tested and works.

LoicTheAztec
  • 229,944
  • 23
  • 356
  • 399
  • I don't understand what to delete and what to replace.... this is how it now looks: // define the woocommerce_single_product_summary callback function function my_custom_action() { echo '

    Heb je een vraag over dit product? Neem gerust contact op met de klantenservice, stuur een privé berichtje via Facebook of klik op de chat rechts onder.

    '; }; add_action( 'woocommerce_single_product_summary', 'my_custom_action', 15 );
    – Lianne Jul 18 '18 at 13:29
  • When I add it, I get this message: The code snippet you are trying to save produced a fatal error on line 17: Cannot redeclare my_custom_action() (previously declared in /home/poesch.nl/public_html/nieuwewebsite.poesch.nl/wp-content/plugins/code-snippets/php/snippet-ops.php(352) : eval()'d code:3) – Lianne Jul 19 '18 at 12:50
  • which one do I use now? // 1. Remove the description product tab add_filter( 'woocommerce_product_tabs', 'remove_descrip_product_tab', 98 ); function remove_descrip_product_tab( $tabs ) { // Remove the description tab unset( $tabs['description'] ); return $tabs; } // 2. Add the product description after the product short description add_action( 'woocommerce_single_product_summary', 'my_custom_action', 25 ); function my_custom_action() { global $post; // Product description output echo '
    ' . the_content() . '
    '; }
    – Lianne Jul 23 '18 at 13:46
  • if that's the one to use, it still causes a fatal error – Lianne Jul 23 '18 at 13:46
  • @Lianne Sorry this code just work fine… I have test it again. So you are doing something wrong, when adding it to your function.php file. – LoicTheAztec Jul 23 '18 at 13:51
  • so I should use the code above AND this one??? // define the woocommerce_single_product_summary callback function function my_custom_action() { echo '

    This is my custom action function

    '; }; add_action( 'woocommerce_single_product_summary', 'my_custom_action', 15 );
    – Lianne Jul 31 '18 at 20:04