morganjamesj
morganjamesj

Reputation: 31

Removing Short Product Description on main shop in WooCommerce on OceanWP theme

Disclaimer

I am a noob at any kind of coding, but have to build my own website.

Okay I have downloaded and set up my child theme of OceanWP and activated it.

Imported all the file into the child theme (not sure what I needed to edit).

I am trying to edit the WooCommerce products display page (main shop archive?) to stop it from showing the short description under each product but retain it in the single product page.

I have tried using CSS in the customizer. Have also tried copy and pasting filters into the functions.php from other threads, but nothing changes.

Am I supposed to change this in the function.php or the WooCommerce product owp-archive-product.php?

When I edit my custom product page with Elementor Pro, it doesn't display the short description until I load the page in a live preview and then everything is pushed out of line because some products don't have short descriptions.

Not sure what to do or what I am doing wrong here.

Sorry if this post isn't in the correct format I'm new here.

Appreciate any help to solve this issue.

Thank you.

Upvotes: 1

Views: 2648

Answers (2)

Terungwa
Terungwa

Reputation: 427

This question is old but someone else may stumble on this in search of a solution to the same problem. Please use this:

remove_action( 'woocommerce_single_product_summary', 'woocommerce_template_single_excerpt', 20);

In the code snippet above, the woocommerce_template_single_excerpt() function outputs the product short description (excerpt). This function is invoked at the woocommerce single product's page hook woocommerce_single_product_summary.

The remove_action() function will remove the woocommerce_template_single_excerpt() function attached to the specified action hook woocommerce_single_product_summary on the singles product page.

References:

  1. https://woocommerce.wp-a2z.org/oik_api/woocommerce_template_single_excerpt/
  2. https://developer.wordpress.org/reference/functions/remove_action/

Upvotes: 0

Nemar162
Nemar162

Reputation: 30

The Easiest way would be just to leave the short description blank in the backend, however, You can remove the Short Description field from the WooCommerce admin area via PHP:

function remove_short_description() {
     remove_meta_box( 'postexcerpt', 'product', 'normal');
}

add_action('add_meta_boxes', 'remove_short_description', 999);

Upvotes: 0

Related Questions