首页 文章

如何删除WooCommerce商店图片?

提问于
浏览
0

我还没有找到任何解决方案,这里是商店页面(不是产品页面)现在看起来以及我想要删除的截图:https://imgur.com/XEELei1

我已经尝试过添加:

//从商店循环中移除产品图片remove_action('woocommerce_before_shop_loop_item_title','woocommerce_template_loop_product_thumbnail',10);

//从商店循环中删除销售徽章remove_action('woocommerce_before_shop_loop_item_title','woocommerce_show_product_loop_sale_flash',10);

在functions.php中,但该图像仍然存在 .

谢谢 .

2 回答

  • 0

    如果是商店页面,请尝试以下代码

    function before_imageless_product() {
     if( !has_post_thumbnail( get_the_id() ) ){
        remove_action( 'woocommerce_before_shop_loop_item_title', 'woocommerce_template_loop_product_thumbnail', 10 );
        echo '<div class="no-image">';
     }
    }
    add_action( 'woocommerce_before_shop_loop_item', 'before_imageless_product', 9 );
    
    function after_imageless_product() {
     if( !has_post_thumbnail( get_the_id() ) ){
        add_action( 'woocommerce_before_shop_loop_item_title',      'woocommerce_template_loop_product_thumbnail', 10 );
        echo '</div>';
     }
    }
    add_action( 'woocommerce_after_shop_loop_item', 'after_imageless_product', 9 );
    
  • 0

    这解决了这个问题:

    .products .box-image {display:none;}
    .products .product-small .box-text {display:flex!important; } 
    .products .product-small .price-wrapper {margin:20px;}
    

相关问题