AI Verified

Name

Add Product Image WooCommerce Checkout Page

Language

PHP

Rating

Voted: 2 by 2 user(s)

How to Setup Snippet

Use Code snippet / copy paste code

Codevault

trt-digital-ma

Scroll down to see more snippets from this codevault.

Wordpress Compatability

The author has indicated that this snippet is compatable up to wordpress version: 6.1

Our AI bot has checked this snippet is compatable up to wordpress version: 6.1

Code Snippet Plugin Sync

Free & Pro

Download this snippet by clicking the download button, then head over to the Code Snippet Plugin settings in your wordpress admin dashboard, select the import menu then upload this file to import into your wordpress site.

Pro Only (Coming Soon)

You will be able to click a button and sync this snippet to your wordpress site automatically and from your dashboard manage all code snippets across all your wordpress sites that have the Code Snippets Pro plugin installed.

Website/ Profile URL:

https://www.trtdigital.ma

History

Last modified:

08/06/2023

Important Note

This snippet has the following status:

AI Verified

This snippet has been tested by our AI bot, see any comments below.

AI Bot Comments:

Found 0 vulnerabilities

Add Product Image WooCommerce Checkout Page

 
                    
1/**
2 * @snippet WooCommerce Show Product IMG @ Checkout Page
3*/
4 
5add_filter( 'woocommerce_cart_item_name', 'trt_product_image_on_checkout', 10, 3 );
6 
7function trt_product_image_on_checkout( $name, $cart_item, $cart_item_key ) {
8 
9 /* Return if not checkout page */
10 if ( ! is_checkout() ) {
11 return $name;
12 }
13 
14 /* Get product object */
15 $_product = apply_filters( 'woocommerce_cart_item_product', $cart_item['data'], $cart_item, $cart_item_key );
16 
17 /* Get product thumbnail */
18 $thumbnail = $_product->get_image();
19 
20 /* Add wrapper to image and add some css */
21 $image = '<div class="trt-product-image" style="width: 320px; height: 140px; display: inline-block; padding-right: 7px; vertical-align: middle;">'
22 . $thumbnail .
23 '</div>';
24 
25 /* Prepend image to name and return it */
26 return $image . $name;
27 
28}

2

Related Snippets

Please see some snippets below related to this snippet..

WooCommerce

AI Verified

2

Adds a custom link in Woocommerce client dashboard

Added: 2 years ago

Last Updated: 2 months ago

This will add a custom menu link in your Woocommece client dashboard, this will link off to your desired page.

WooCommerce

AI Verified

0

Remove "Has Been Added to Your Cart" WooCommerce Message

Added: 2 years ago

Last Updated: 1 year ago

WooCommerce

AI Verified

0

Edit WooCommerce Price Display

Added: 2 years ago

Last Updated: 1 year ago

Other Snippets in this Codevault

These are some popular snippets from this users codevault..

WooCommerce

AI Verified

2

Add Product Image WooCommerce Checkout Page

Added: 1 year ago

Last Updated: 1 year ago

WooCommerce

AI Verified

1

Woo-Commerce Change Place-Order Button-Text

Added: 1 year ago

Last Updated: 1 year ago

In this article, we will learn to change the place order button text with our own custom text.