Viewing 4 replies - 1 through 4 (of 4 total)
  • Plugin Author Saravana Kumar K

    (@mycholan)

    That’s kind of specific requirement, but right now there is no option to do it from WC Fields Factory, but you can via by handling woocommerce_order_items_meta_display hook.

    Here is an idea.

    function hide_wcff_meta( $output, $order ) {
    	$html = '';
    	$formatted_meta = $order->get_formatted( '_' );
    
    	if ( ! empty( $formatted_meta ) ) {
    		$meta_list = array();
    
    		foreach ( $formatted_meta as $meta ) {
    			/* Here you can add as many as condition you want, depends on how many fields you wanted to hide */
    			if( $meta['label'] != "Your Fields Label" ) {
    				$meta_list[] = '
    						<dt class="variation-' . sanitize_html_class( sanitize_text_field( $meta['key'] ) ) . '">' . wp_kses_post( $meta['label'] ) . ':</dt>
    						<dd class="variation-' . sanitize_html_class( sanitize_text_field( $meta['key'] ) ) . '">' . wp_kses_post( wpautop( make_clickable( $meta['value'] ) ) ) . '</dd>
    					';
    			}
    		}
    
    		if ( ! empty( $meta_list ) ) {
    			$html .= '<dl class="variation">' . implode( '', $meta_list ) . '</dl>';
    		}
    	}
    
    	return $html;
    }
    
    add_filter( 'woocommerce_order_items_meta_display', 'hide_wcff_meta', 99, 2 );
    Thread Starter efrap

    (@efrap)

    Thank you for this outstanding support. I will try it out.

    Thread Starter efrap

    (@efrap)

    Since I have no need to display any meta, I have simplified your function:

    function hide_wcff_meta( $output, $order ) {
    	$html = '';
    	return $html;
    }
    add_filter( 'woocommerce_order_items_meta_display', 'hide_wcff_meta', 99, 2 );

    Thank you for directing me to a solution.

    Plugin Author Saravana Kumar K

    (@mycholan)

    Great, Ok let me close this as resolved. also I would really appreciate your rating and review, if this plugin is useful. that would be great.

    Regards
    Sark

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Hide meta from order and emails’ is closed to new replies.