How to add product photos at checkout page

woocommerce-product-image-checkout-page

How to add product photos at checkout page:

The order review section of the default woocommerce checkout page displays the product name, quantity, and total amount, but does not display a representative image of the product. If you want to display more featured images of the product to help customers double check before placing an order, you can follow the instructions below.

woocommerce-product-image-checkout-page
woocommerce-product-image-checkout-page

Copy and paste the following code into functions.php!

add_filter( 'woocommerce_cart_item_name', 'flatsomeaz_product_image_review_order_checkout', 9999, 3 );

function flatsomeaz_product_image_review_order_checkout( $name, $cart_item, $cart_item_key ) {
if ( ! is_checkout() ) return $name;
$product = $cart_item['data'];
$thumbnail = $product->get_image( array( '50', '50' ), array( 'class' => 'alignleft' ) );
return $thumbnail . $name;
}

Tested and code working perfectly!

Trả lời

Email của bạn sẽ không được hiển thị công khai.