public function get_image($size = 'shop_thumbnail', $attr = array(), $placeholder = true)
{
if (has_post_thumbnail($this->get_id())) {
$image = get_the_post_thumbnail($this->get_id(), $size, $attr);
} elseif (($parent_id = wp_get_post_parent_id($this->get_id())) && has_post_thumbnail($parent_id)) {
$image = get_the_post_thumbnail($parent_id, $size, $attr);
} elseif ($placeholder) {
$image = wc_placeholder_img($size);
} else {
$image = '';
}
return str_replace(array('https://', 'http://'), '//', $image);
}
/** * Filter the document table row cells to add product thumbnail column data * * @param string $table_row_cells The table row cells. * @param string $type WC_PIP_Document type * @param string $item_id Item id * @param array $item Item data * @param \WC_Product $product Product object * @return array The filtered table row cells. */ function sv_wc_pip_document_table_row_cells_product_thumbnail($table_row_cells, $document_type, $item_id, $item, $product) { // get the product's or variation's thumbnail 'shop_thumbnail' size; we will use CSS to set the width $thumbnail_content = array('product_thumbnail' => $product->get_image()); // add product thumnail column as the first column return array_merge($thumbnail_content, $table_row_cells); }