Woocommerce - Removing price from Product page but not globally

Hi there!

Firstly on my site, https://dhbrownstaging.wpengine.com/storefront/landscapes/dolomite-fields/, I’m trying to remove one pricing field, the first one on the product page. I have attached a screenshot. Everything I am trying is removing the price globally i.e. on the storefront page, the category page, etc. I just need to remove it from the top of the single product pages as it is confusing.

Second, I have a problem with the image cropping. When I go under customizer > woocommerce > Product images > and I set the thumbnail cropping to 1:1, it makes everything look good on the store and category pages, but the checkout is cropped and doesn’t show the whole image. Conversely, when I have it set to no cropping, the checkout looks great but the storefront and category pages don’t. Is there a way I can set the checkout page to not crop, while allowing Wordpress to crop everything else?

Thanks for the help!

Hi,

To remove the price on the product page, you can add the code below in your child theme’s functions.php file

remove_action( 'woocommerce_single_product_summary', 'woocommerce_template_single_price', 10 );

With regards to product images, checkout page should not display an image. Maybe you mean Cart Page?
I checked on my test site and the image on the cart page should display the same as ni your shop.
Please set the thumbnail cropping to 1:1 again then provide us the url of the page where the image is cropped.

Thanks

Ok that worked great on the price. Thank you!

Here’s the screenshot of the 1:1 cropping in the Cart Page ( I stated checkout about but meant cart)

This does work for the store page but leaves the cart page looking unattractive and doesn’t let you see the product you are buying.

How can we exclude the Cart page from being cropped?

Thanks so much!


Ok, so one last request regarding the price that we just removed. How could I insert a small bit of type below the Product Title? I’d like for it to say By Dylan H. Brown right below the product name. This is static and won’t need to change.

Thank you so much!

Hi there,

You can do it through CSS like this:

.single-product .product_title:after {
    content: "By Dylan H. Brown";
    display: block;
    font-size: 0.8em;
    letter-spacing: 0;
    margin-top: 10px;
}

Here are some related links for further reading:

Hope this helps.

Ok that worked great on the price. Thank you! !

Here’s the screenshot of the 1:1 cropping in the Cart Page ( I stated checkout about but meant cart)

This does work for the store page
but leaves the cart page looking unattractive and doesn’t let you see the product you are buying.
How can we exclude the Cart page from being cropped?

FYI this was missed earlier in the thread when I posted a followup question. Appreciate the help!

Thanks so much!

Hi,

To exclude the cart page from being cropped, you can add the code below in your child theme’s functions.php file

add_filter( 'woocommerce_get_image_size_thumbnail', 'cart_image_size');

function cart_image_size( $size) {
    if(is_cart()) {
        return array(
            'width'  => 150,
            'height' => 150,
            'crop'   => 0,
        );
    }
    return $size;
}

You may add it after this line of code

// Additional Functions
// =============================================================================

Hope that helps

Hi Paul,
That came close but still crops the images. I changed the width variable to 300 and it works now though! Thanks for the help!

You’re welcome! :slight_smile:

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.