Woocommerce | Change “add to cart” text on archives depending on product type

// Change add to cart text on archives depending on product type
add_filter( 'woocommerce_product_add_to_cart_text' , 'custom_woocommerce_product_add_to_cart_text' );
function custom_woocommerce_product_add_to_cart_text() {
    global $product;
    $product_type = $product->product_type;
    switch ( $product_type ) {
        case 'external':
            return __( 'Add to cart', 'woocommerce' );
        break;
        case 'grouped':
            return __( 'Add to cart', 'woocommerce' );
        break;
        case 'simple':
            return __( 'Add to cart', 'woocommerce' );
        break;
        case 'variable':
            return __( 'Add to cart', 'woocommerce' );
        break;
        default:
            return __( 'Add to cart', 'woocommerce' );
    }
};

 

This website may contain fan art inspired by existing characters from films, TV shows, or games. I don't own any rights to those characters — any copyright owner wishing to have a fan art removed can contact me here. This is a personal portfolio and store. It uses only the essential cookies needed for the site, cart, and account to work — no analytics, no tracking, no advertising.