Last active
March 23, 2021 16:15
-
-
Save rynaldos-zz/d77da0cd20a0c75a9997f2ac73af584f to your computer and use it in GitHub Desktop.
Add product images to WooCommerce checkout page order review
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function rs_woo_cart_attributes($cart_item, $cart_item_key) { | |
global $product; | |
if (is_cart()){ | |
echo "<style>#checkout_thumbnail{visibility:hidden;}</style>"; | |
} | |
$item_data = $cart_item_key['data']; | |
$post = get_post($item_data->get_id()); | |
$thumb = get_the_post_thumbnail($item_data->get_id(), array( 32, 50)); | |
echo '<div id="checkout_thumbnail" style="float: left; padding-right: 8px">' . $thumb . '</div> ' . $post->post_title; | |
} | |
add_filter('woocommerce_cart_item_name', 'rs_woo_cart_attributes', 10, 2); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment