-2

actully i want to resize the cart item thumbnail on checkout page of WooCommerce currently i am using I can't change the product image size for woocommerce anser code in my child theme

but when i add this in my child functions .. it also resize the thubnail of main home page. i want this function to run only on woocommerce checkout page. please help me to fix that. i have tried is_page function also but running into error.

7uc1f3r
  • 28,449
  • 17
  • 32
  • 50
  • try to add item in cart and go to checkout on this website https://www.divyajadibuti.in/ currently i am using a function which works both home page and checkout but i want to run it on checkout page only you can cleary see at checkout page there is 2 images showing of same item the 2nd is bit bigger than 1st image . – Ashish Agarwal Oct 03 '21 at 07:58

3 Answers3

0

You can use Woocommerce Conditional tag of Checkout Page.

if ( is_checkout() ) {
  // Your Code Here
} 

Source: https://docs.woocommerce.com/document/conditional-tags/

Mr SKT
  • 5
  • 4
0

You can use the WooCommerce Visual Hook to run the code only on the checkout

add_action('woocommerce_before_checkout_form','function_name');
function function_name(){
   //your code here
}

source:https://www.businessbloomer.com/woocommerce-visual-hook-guide-checkout-page

0

You can try this:

if(is_checkout()){
    add_filter( 'woocommerce_get_image_size_thumbnail', function( $size ) {
        return array(
        'width' => 427,
        'height' => 427,
        'crop' => 0,
        );
    });
}
Tomerikoo
  • 18,379
  • 16
  • 47
  • 61
Keerthi S
  • 177
  • 1
  • 5