• Resolved david221

    (@david221)


    I’ve added a product, and right now I uploaded a Featured Image and put down the product information under the Product Short Description field.

    What I want to do now is to write a summary of the product at the top of the page. I realize to do that, though, is that I’d have to edit or create the hooks in the plugin’s template folder. I’ve already added a copy of the short-description.php file and increased the width of the container for the short description field. But how do I create the new field? Is there a hook in the plugin’s templates folder that I can change or do I need to create one?

    https://wordpress.org/plugins/woocommerce/

Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Contributor Mike Jolley

    (@mikejolley)

    Why don’t you use short description for your summary and the main content area for the full content? Thats how it was intended to be used.

    Thread Starter david221

    (@david221)

    Never mind, I eventually worked it out.

    First, I took a copy of the content-single-product.php file from woocommerce’s plugin folder, and then I put it into my child theme folder.

    I grabbed this block of code under <!– .summary –>:

    <?php
    /**
    * woocommerce_after_single_product_summary hook
    *
    * @hooked woocommerce_output_product_data_tabs – 10
    * @hooked woocommerce_upsell_display – 15
    * @hooked woocommerce_output_related_products – 20
    */
    do_action( ‘woocommerce_after_single_product_summary’ );
    ?>

    …and moved it up to the top, before <div itemscope itemtype=”<?php echo woocommerce_get_product_schema(); ?>”.

    And then finally, I went to the functions.php file, and added these lines at the bottom of the page:

    remove_action( ‘woocommerce_single_product_summary’, ‘woocommerce_template_single_title’, 5 );
    add_action( ‘woocommerce_before_single_product_summary’, ‘woocommerce_template_single_title’, 5 );

    Thread Starter david221

    (@david221)

    I should also mention that changing the code and adding the actions here don’t remove or add fields, but instead they re-arrange the short description field to appear on the top of the page.

Viewing 3 replies - 1 through 3 (of 3 total)

The topic ‘Editing single products’ is closed to new replies.