wordpress - 如何在购物车页面上显示 Woocommerce 图像
问题描述
我开发了一个 woo-commerce 网站,所有产品图片都显示,但这些图片在购物车页面中没有全尺寸显示,我希望产品图片全尺寸显示,请帮帮我?
$thumbnail = apply_filters( 'get_the_post_thumbnail_url', $_product->get_image(), $cart_item, $cart_item_key, 'full' );
if ( ! $product_permalink ) {
echo $thumbnail;
} else {
printf( '<a href="%s">%s</a>', esc_url( $product_permalink ), $thumbnail );
}
解决方案
Try this code.
You need to add full
in $_product->get_image('full')
<?php
$thumbnail = apply_filters( 'woocommerce_cart_item_thumbnail', $_product->get_image('full'), $cart_item, $cart_item_key );
if ( ! $product_permalink ) {
echo $thumbnail; // PHPCS: XSS ok.
} else {
printf( '<a href="%s">%s</a>', esc_url( $product_permalink ), $thumbnail ); // PHPCS: XSS ok.
}
?>
推荐阅读
- pandas - Finding all negative values in Pandas and multiplying with -1
- cordova - iOS 13+ ionic 4 iOS app stuck at splash screen
- ansible - 如何防止 Ansible / Jinja2 随机排序我的配置
- amazon-web-services - serverless.yml Output exports does not work as expected
- c# - 使用 C# Google.Protobuf 将 ByteString 反序列化为对象
- sql - SQL - 以日期间隔聚合数据
- php - Jquery Ajax Sends same value for each new request
- spring - Google App Engine ClassNotFound after Deployment but it Works on Local
- swift - High-Quality Rendering – RealityKit vs SceneKit vs Metal
- java - How can put multiple Hashmap in java into a new hashmap?