最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

filters - Remove add to cart iconview product button woocommerce

programmeradmin2浏览0评论

I'm trying to remove a button that appears when hovering over the images on a woocommerce shop. (See images attached) The product is a variable product.

Failing being able to do this I also tried to format it so it's a normal 'view product' button using the below code. However I'm struggling on how else to format it. Any help much appreciated.

// Change button text on WooCommerce Shop pages
add_filter( 'woocommerce_product_add_to_cart_text', 'woocustomizer_edit_shop_button_text' );

function woocustomizer_edit_shop_button_text() {
    global $product;
    $product_type = $product->get_type(); // Get the Product Type

    // Change text depending on Product type
    switch ( $product_type ) {
        case "variable":
            return __( '£', 'woocommerce' );
            break;
        case "grouped":
            return __( 'View All Products', 'woocommerce' );
            break;
        case "external":
            // Button label is added when editing the product
            return esc_html( $product->get_button_text() );
            break;
        default:
            return __( 'Buy Now', 'woocommerce' );
    }
}
发布评论

评论列表(0)

  1. 暂无评论