L
L
leviathan2017-07-31 14:18:15
PHP
leviathan, 2017-07-31 14:18:15

How to get thumbnail link in woocommerce?

By default, the image is displayed like this:

$thumbnail = apply_filters( 'woocommerce_cart_item_thumbnail', $_product->get_image(), $cart_item, $cart_item_key );

In html it looks like this:
<a href="http://site.ru/dev.ru/product/%d0%bf%d1%80%d0%be%d0%b1%d0%bd%d1%8b%d0%b9-%d1%82%d0%be%d0%b2%d0%b0%d1%80/"><img width="143" height="107" src="//site.ru/dev.ru/wp-content/uploads/2017/07/tg2.png" class="attachment-shop_thumbnail size-shop_thumbnail wp-post-image" alt=""></a>

But I need to display it as a background, but for this I need to get only the url of the image.
Working in "cart.php" file

Answer the question

In order to leave comments, you need to log in

1 answer(s)
D
Denis Yanchevsky, 2017-07-31
@deniscopro

the_post_thumbnail_url or get_the_post_thumbnail_url .

global $post;
<?php echo get_the_post_thumbnail_url($post->ID, 'shop_thumbnail'); ?>

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question