ASTRA_Ext_WooCommerce_Markup::add_cart_product_image( string $product_name, object $cart_item, string $cart_item_key )

Add or remove cart product image.


Description


Parameters

$product_name

(string) (Required) product name.

$cart_item

(object) (Required) cart item.

$cart_item_key

(string) (Required) cart item key.


Return

(string) HTML markup.


Source

File: addons/woocommerce/classes/class-astra-ext-woocommerce-markup.php

		public function add_cart_product_image( $product_name, $cart_item, $cart_item_key ) {
			$image              = '';
			$is_thumbnail_class = 'ast-disable-image';
			if ( ! defined( 'CARTFLOWS_VER' ) && is_checkout() && ! is_wc_endpoint_url( 'order-received' ) && 'modern' === astra_get_option( 'checkout-layout-type' ) && astra_get_option( 'checkout-order-review-product-images', false ) ) {

					// 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();

					$is_thumbnail_class = isset( $thumbnail ) ? 'ast-enable-image' : 'ast-disable-image';

					// Add wrapper to image and add some css.
					$image = '<div class="ast-product-thumbnail">' . $thumbnail . ' </div>';
			}
			$product_name = '<div class="ast-product-image ' . $is_thumbnail_class . '"> ' . $image . ' <div class="ast-product-name">' . $product_name . '</div></div>';

			return $product_name;
		}

User Contributed Notes

You must log in before being able to contribute a note or feedback.