Home Forums WoodMart support forum Catalog Mode Reply To: Catalog Mode

#20601

jinsley8
Participant

Okay I fixed it with my own functions – for anyone looking to do the same:

add_action('after_setup_theme','custom_activate_filter') ; 

function custom_activate_filter()
{
   add_filter('woocommerce_get_price_html', 'custom_show_price_logged');
}

function custom_show_price_logged($price)
{
   if(is_user_logged_in() )
   {
      return $price;
   }
   else
  {
    // Remove Price from Single Product Page
    remove_action( 'woocommerce_single_product_summary', 'woocommerce_template_single_price', 10 );

     // Remove Price from Shop/Category Pages
    remove_action( 'woocommerce_after_shop_loop_item_title', 'woocommerce_template_loop_price', 10 );

    // Remove Add to Cart from Shop/Category Pages (Limitation: This code will remove "Select Option" from Grouped and Variable product also
    remove_action( 'woocommerce_after_shop_loop_item', 'woocommerce_template_loop_add_to_cart', 10 );

    // Remove Add to cart from Single Product Page
    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 );
    remove_action( 'woocommerce_single_variation', 'woocommerce_single_variation_add_to_cart_button', 20 );

    return '<a href="/login">Login for pricing</a>';
  }
}