• Resolved telemarker

    (@telemarker)


    hello,
    i am using the offical dhl plugin for labels.
    how can i disable the option to create labels for gift card orders.
    thanks and all my best
    telemarker

Viewing 5 replies - 1 through 5 (of 5 total)
  • Hello @telemarker ,

    I got your concern but dhl plugin is not compatible with our plugin.

    Thanks

    Thread Starter telemarker

    (@telemarker)

    maybe the plugin could create a giftcard class in the order item, so i can set up some css to disable certain fields.
    thanks

    Our plugin is not creating any class for order item, but if you want then we can check the possibility in next ver releases.

    Thread Starter telemarker

    (@telemarker)

    i found a way to achieve this with a little snippet thats add the products category to the order posts.

    add_filter( 'admin_body_class', function( $class ) {
    	$screen = get_current_screen();
    	$new_classes = [
    		'user-' . get_current_user_id(),
    	];
    	
    	if( 'post' === $screen->base && 'shop_order' === $screen->post_type ) {
    		$order = wc_get_order( get_the_ID() );
    		$category_classes = [];
    		
    		foreach( $order->get_items() as $item_id => $item ) {
    			$product_id = $item->get_product_id();
    			$product_categories = get_the_terms( $product_id, 'product_cat' );
    			
    			foreach( $product_categories as $category )
    				$category_classes[] = 'cat-' . $category->slug;
    		}
    		
    		$category_classes = array_unique( $category_classes );
    		$new_classes = array_merge( $new_classes, $category_classes );
    	}
    	
    	$new_classes = implode( ' ', $new_classes );
    	$class .= ' ' . $new_classes;

    after that i simply add some admin css:
    .cat-mwb_wgm_giftcard .postbox-container #woocommerce-shipment-dhl-label { display: none; }

    • This reply was modified 4 years, 3 months ago by telemarker.
    • This reply was modified 4 years, 3 months ago by telemarker.

    Okay if it works for you then really great. For any other queries we are here.

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘hide from dhl labeling’ is closed to new replies.