Adrian
Adrian

Reputation: 23

How to Remove Price from woocoomerce widgets?

with the help of Loic i have been able to remove the prices the category page but I also realized that I have widgets that have prices as well...top rated, best seller, etc...

I am assuming(most likely incorrectly) that i would use something similar to the following:

remove_action( 'woocommerce_after_shop_loop_item_title', 'woocommerce_template_loop_price', 10 );

I have been trying to figure out what hooks i need to work with to accomplish this but I am still way to new to this.

Any pointing in the right direction would be awesome.

thanks Adrian

Upvotes: 0

Views: 520

Answers (1)

Andrew Schultz
Andrew Schultz

Reputation: 4243

You can modify the WooCommerce template templates/template content-widget-product.php. You can override it with your own version and remove the line that prints the product price. Copy it to your theme folder yourtheme/woocommerce/content-widget-product.php. Here is the section of code I am referring to with the commented out product price.

<?php if ( ! empty( $show_rating ) ) : ?>
        <?php echo wc_get_rating_html( $product->get_average_rating() ); ?>
    <?php endif; ?>

    <?php //echo $product->get_price_html(); ?>

    <?php do_action( 'woocommerce_widget_product_item_end', $args ); ?>

I don't see anyway of accomplishing this filters so overwriting the template seems like the only way to do it.

Upvotes: 1

Related Questions