• Resolved peorthyr

    (@peorthyr)


    Good day all.
    I’ve added this function to the theme:

    function western_custom_buy_buttons(){
    
       $product = get_product();
    
       if ( has_term( 'exclusive', 'product_cat') ){
    
           // removing the purchase buttons
    
           remove_action( 'woocommerce_after_shop_loop_item', 'woocommerce_template_loop_add_to_cart' ); 
    
           remove_action( 'woocommerce_single_product_summary', 'woocommerce_template_single_add_to_cart', 30 );
    
           remove_action( 'woocommerce_simple_add_to_cart', 'woocommerce_simple_add_to_cart', 30 );
    
           remove_action( 'woocommerce_grouped_add_to_cart', 'woocommerce_grouped_add_to_cart', 30 );
    
           remove_action( 'woocommerce_variable_add_to_cart', 'woocommerce_variable_add_to_cart', 30 );
    
           remove_action( 'woocommerce_external_add_to_cart', 'woocommerce_external_add_to_cart', 30 );
    
       }
    
    }
    
    add_action( 'wp', 'western_custom_buy_buttons' );

    but instead of just removing the button, I’d like to add a simple text/link, so for some categories, the add to cart button is not shown, and a different link si shown instead.

    does anyone has a clue?

Viewing 3 replies - 1 through 3 (of 3 total)
Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘wocommerce change the "add to cart" into another link, only in some categories’ is closed to new replies.