Hiện thêm ảnh sản phẩm tại trang thanh toán
Bỏ đoạn code sau vào function.php của theme.
add_filter( 'woocommerce_cart_item_name', 'isures_add_image_in_order_review', 9999, 3 );
function isures_add_image_in_order_review( $name, $cart_item, $cart_item_key ) {
if ( ! is_checkout() ) return $name;
$data = $cart_item['data'];
$thumbnail = $data->get_image( array( '50', '50' ), array( 'class' => 'isures-image--review' ) );
return $thumbnail . $name;
}
Tại dòng số 6: 50 là size ảnh. Bạn có thể thay đổi tùy ý. 100 100 hoặc 150 150 gì đấy.
Thêm 1 đoạn nhỏ css cho đẹp. Bỏ code dưới vào style.css
.isures-image--review {
float: left;
margin-right: 8px;
border-radius: 5px;
}
Chia sẻ :
