• Resolved Caridor

    (@shaar7)


    Hi,

    Please is it possible to remove the vendor name from the checkout page and cart?

    I need some vendors not be showing only showing the product on the page without his name.

    but for some products, I need the vendor names to be visible.

    from CSS it will hide all which is I don’t need.

    for more clarification: please check the image, there is 2 color red and blue for example I need blue be showing and red not
    https://prnt.sc/vx2t90

    thanks

Viewing 2 replies - 1 through 2 (of 2 total)
  • Hello @shaar7 ,

    I have an interesting solution for you. Please note that, according to our support policy I am restricted to provide customization solutions. I only share the information that I already have ready or can be modified according to your need. For full solutions I will recommend to contact an expert. Now, let’s see how can we achieve the result you want.

    The only thing you need to get the vendor user ID to select each vendor. There are tons of ways for that, see – https://www.wpbeginner.com/beginners-guide/how-to-find-post-category-tag-comments-or-user-id-in-wordpress/

    The code you will use is this –

    // First remove the original filter to show vendor name
    remove_filter( 'woocommerce_get_item_data', 'dokan_product_seller_info', 10, 2 );
    
    function dokan_product_seller_info_hide_chosen_ones( $item_data, $cart_item ) {
        $vendor = dokan_get_vendor_by_product( $cart_item['product_id'] );
    
        $hide_vendor = array(2); //add the vendor IDs that should not show the names
    
        if ( ! $vendor ) {
            return $item_data;
        }
    
        if ( !in_array($vendor->get_id(), $hide_vendor) ) {
    
        	$item_data[] = array(
        	    'name'  => __( 'Vendor', 'dokan-lite' ),
        	    'value' => $vendor->get_shop_name(),
        	);
        }
    
        return $item_data;
    }
    
    // Adds our custom vendor names with conditions
    add_filter( 'woocommerce_get_item_data', 'dokan_product_seller_info_hide_chosen_ones', 10, 2 );

    I hope you will share your appreciation by rating us on www.ads-software.com.

    Thank you ??

    Thread Starter Caridor

    (@shaar7)

    Woooow.

    It works as sharp amazing bro. Thank You a lot :):):):)

    I already gave you a full rating on WordPress.

    Thank Again. hats Off

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘remove vendor name from cart and checkout’ is closed to new replies.