• Resolved Niraj Singh

    (@nirajsharp)


    hi i want to show only product image in review order table in checkout page how to do this
    i have made some custom change to remove subtotal and total via css think there must be a way to do it better way, plus make thing scalable for different screen sizes.

    The page I need help with: [log in to see the link]

Viewing 6 replies - 1 through 6 (of 6 total)
  • Hi @nirajsharp,

    That’s a bit tricky to do with the current markup of the checkout page. The product name is directly in the product-name cell along with the div that holds the image. It would be helpful to have the name in its own div so it can be hidden or just removed altogether from the source code.

    Can you send over the cod you used to add the image? It may be able to point us to a solution.

    Thanks!

    Thread Starter Niraj Singh

    (@nirajsharp)

    hi thanks for the reply
    blow is the code i have increased only width and height little to make image larger you can see.

    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 ) {
         
        /* 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: 283px; height: 226.4px; display: inline-block; padding-right: 7px; vertical-align: middle;">'
                    . $thumbnail .
                '</div>'; 
     
        /* Prepend image to name and return it */
        return $image . $name;
    }

    Hi @nirajsharp,

    One way would be to remove the $name from that function. That would only leave the image behind that you’ve just added and keep us from needing to hide it with CSS.

    
    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 ) {
         
        /* 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="">'
                    . $thumbnail .
                '</div>'; 
     
        /* Prepend image to name and return it */
        return $image;
    }
    
    

    Thread Starter Niraj Singh

    (@nirajsharp)

    Thanks it worked perfectly

    Thread Starter Niraj Singh

    (@nirajsharp)

    hi,
    any way to add link of product to that image
    thanks

    Plugin Support Shohan Hossain Nabil – a11n

    (@sohanhossain)

    Hey there,

    There hasn’t been much activity on this thread, so I wanted to add a few more options for you.

    if you do require more help with the actual coding, we’d recommend you hire a developer who can take a look at this, quote you for their services, and help you add this feature to your site. We’d recommend getting in touch with a web developer or one of the customization experts listed at?https://woocommerce.com/customizations/.

    Please kindly note that this requires some custom coding – which goes beyond the scope of support we are able to provide in this forum.

    I’m going to mark this as resolved – if you have any further questions, you can start a new thread.

    Thanks for understanding.

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘How do I hide the order_review table in WooCommerce?’ is closed to new replies.