Search
 
SCRIPT & CODE EXAMPLE
 

PHP

add image thumb on checkout woo

/**
* @snippet       WooCommerce Show Product Image @ Order-Pay Page
*/

add_filter( 'woocommerce_order_item_name', 'ts_product_image_on_order_pay', 10, 3 );

function ts_product_image_on_order_pay( $name, $item, $extra ) {

/* Return if not checkout page */

if ( ! is_checkout() ) {

return $name;

}

$product_id = $item->get_product_id();

/* Get product object */

$_product = wc_get_product( $product_id );

/* Get product thumbnail */

$thumbnail = $_product->get_image();

/* Add wrapper to image and add some css */

$image = '<div class="ts-product-image" style="width: 52px; height: 45px; display: inline-block; padding-right: 7px; vertical-align: middle;">'

. $thumbnail .

'</div>';

/* Prepend image to name and return it */

return $image . $name;

}
Comment

PREVIOUS NEXT
Code Example
Php :: get post date and time in wordpress 
Php :: php parameters 
Php :: object initialization 
Php :: updateorinsert laravel for large data 
Php :: string length php online 
Php :: content for php.ini created manually 
Php :: verify that a valid login cookie was sent in order to do special things for that logged-in 
Php :: php loop add class to first element 
Php :: simple-phpunit --version handling the phpunit-setup event returned with error code 127 on ubuntu 
Php :: Class PHPUnit_Util_Log_TeamCity does not exist 
Php :: select all matched text phpstrom 
Php :: Redirect file.php to file with .htaccess | Redirect to its non .php version 
Php :: What is the method of querying from two tables with a condition in Laravel 
Php :: kill phpstorm process ubuntu 
Php :: php get header language 
Php :: Metabox Array 
Php :: big database file into database php 
Php :: Array and string offset access syntax with curly braces is no longer supported in /home/southsah/public_html/wp-content/install.php on line 259 
Php :: php print keys of array 
Php :: org.springframework.web.context.request.async.AsyncRequestTimeoutExceptionTimeoutDeferredResultProcessingInterceptor 
Php :: sha256 encode php 
Php :: in ImageRetriever.php line 305 at ImageRetriever-getNoPictureImage(object(Language)) in FrontController.php line 1527 
Php :: auto reload page in chat php 
Php :: Apache/2.4.52 (Win64) OpenSSL/1.1.1m PHP/7.4.27 Server at localhost Port 80 
Php :: multidimensional session-array 
Php :: How to programmatically grab the product description in WooCommerce? 
Php :: somme array php 
Php :: how to compare two strings ignoring accentuation in php 
Php :: cashier mollie 
Php :: how to fetch data from database in php and display in pdf 
ADD CONTENT
Topic
Content
Source link
Name
4+1 =