Title: Code Snippet has issue with PHP 8.2
Last modified: September 22, 2024

---

# Code Snippet has issue with PHP 8.2

 *  Resolved [kt77](https://wordpress.org/support/users/kt77/)
 * (@kt77)
 * [1 year, 8 months ago](https://wordpress.org/support/topic/code-snippet-has-issue-with-php-8-2/)
 * Having some challenge of previous code in PHP7.4 that is not compatible in PHP
   8.2 which i am trouble shooting it by switch of all the code & activated one 
   by one. When I activated the first code (as shown below), it make the Woocommerce
   Checkout page (Order Summary) to keep loading & hanging there. As i am not sure
   what went wrong as I not a technical guy. Appreciated someone can assist me on
   this matter. Thank you in advance.
 * add_filter( ‘woocommerce_cart_item_name’, ‘ts_product_image_on_checkout’, 10,
   3 );
 * function ts_product_image_on_checkout( $name, $cart_item, $cart_item_key ) {
 *     ```wp-block-code
       /* Return if not checkout page */
       if ( ! is_checkout() ) {
           return $name;
       }
   
       /* Get product object */
       $_product = apply_filters( 'woocommerce_cart_item_product', $cart_item['data'], $cart_item, $cart_item_key );
   
       /* 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;
       ```
   
 * }

Viewing 3 replies - 1 through 3 (of 3 total)

 *  Thread Starter [kt77](https://wordpress.org/support/users/kt77/)
 * (@kt77)
 * [1 year, 8 months ago](https://wordpress.org/support/topic/code-snippet-has-issue-with-php-8-2/#post-18030752)
 * I need help on this. Appreciated someone can assist me
 *  [avercom](https://wordpress.org/support/users/avercom/)
 * (@avercom)
 * [1 year, 8 months ago](https://wordpress.org/support/topic/code-snippet-has-issue-with-php-8-2/#post-18037398)
 * I found this from January. sounds like the same problem you’re having [https://wordpress.org/support/topic/issue-with-php-8-2-2/](https://wordpress.org/support/topic/issue-with-php-8-2-2/)
 *  Plugin Author [Shea Bunge](https://wordpress.org/support/users/bungeshea/)
 * (@bungeshea)
 * [1 year, 6 months ago](https://wordpress.org/support/topic/code-snippet-has-issue-with-php-8-2/#post-18137592)
 * Hi [@kt77](https://wordpress.org/support/users/kt77/),
 * I can’t see anything in your code that wouldn’t work with modern versions of 
   PHP and Code Snippets, so it seems like this might be an issue with newer WooCommerce
   updates. Unfortunately, I don’t really have experience in working with WooCommerce,
   so you might need to reach out to a support forum specific to that plugin to 
   resolve the issue.

Viewing 3 replies - 1 through 3 (of 3 total)

The topic ‘Code Snippet has issue with PHP 8.2’ is closed to new replies.

 * ![](https://ps.w.org/code-snippets/assets/icon.svg?rev=2148878)
 * [Code Snippets](https://wordpress.org/plugins/code-snippets/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/code-snippets/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/code-snippets/)
 * [Active Topics](https://wordpress.org/support/plugin/code-snippets/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/code-snippets/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/code-snippets/reviews/)

 * 3 replies
 * 3 participants
 * Last reply from: [Shea Bunge](https://wordpress.org/support/users/bungeshea/)
 * Last activity: [1 year, 6 months ago](https://wordpress.org/support/topic/code-snippet-has-issue-with-php-8-2/#post-18137592)
 * Status: resolved