• hello, i have the “hide prices for non-logged in users” implemented on my client’s website:

    
     add_action('after_setup_theme','activate_filter') ; 
        function activate_filter(){
        add_filter('woocommerce_get_price_html', 'show_price_logged');
        }
        function show_price_logged($price){
        if(is_user_logged_in() ){
        return $price;
        }
        else
        {
    	
        remove_action( 'woocommerce_after_shop_loop_item', 'woocommerce_template_loop_add_to_cart' );
        remove_action( 'woocommerce_single_product_summary', 'woocommerce_template_single_price', 10 );
        remove_action( 'woocommerce_single_product_summary', 'woocommerce_template_single_add_to_cart', 30 );
    	return '<a href="' . get_permalink(wc_get_page_id('myaccount')) . '">Login for Pricing</a>';	
        remove_action( 'woocommerce_after_shop_loop_item_title', 'woocommerce_template_loop_price', 10 );
    	
        
        }
        }
    

    i have implemented the following function in order to display product sku’s under each of the product titles on all product-category pages:

    
    add_action( 'woocommerce_after_shop_loop_item_title', 'custom_after_title' );
    function custom_after_title() {
    
        global $product;
    
        if ( $product->get_sku() ) {
            echo '<span style="color:#ffffff";>Style#: '. $product->get_sku() . '</span>';
        }
    
    }
    

    the issue:

    sku’s display ok and right underneath the product titles/prices for all users that are logged in.

    for NON-logged in users the product sku’s seem to be displaying UNDER the “log in for pricing” button can someone advise? thank you!

    The page I need help with: [log in to see the link]

Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
  • The topic ‘WooCommerce – displaying item sku’s on product-category pages’ is closed to new replies.