Viewing 8 replies - 1 through 8 (of 8 total)
  • Plugin Contributor Ewout

    (@pomegranate)

    Hi there,
    You can remove this with a filter. My WooCommerce doesn’t show this particular text (only for the order total), but I think the code below should do the trick – you have to place it into your themes functions.php:

    add_filter( 'wpo_wcpdf_woocommerce_totals', 'wpo_wcpdf_remove_includes' );
    function wpo_wcpdf_remove_includes ( $totals ) {
    	if ( isset($totals['shipping'])) {
    		$value = $totals['shipping']['value'];
    		$includes = substr(__( '(Includes %s)', 'woocommerce' ), 0, -3);
    		$totals['shipping']['value'] = ($pos = strpos($value, ' '.$includes)) ? substr($value, 0, $pos) : $value;
    	}
    	return $totals;
    }

    Again, I’m not sure if this will work, as I think this may come from your woocommerce settings (WooCommerce > Settings > Tax > Price Display Suffix).
    This may also come from another plugin (like WooCommerce German Market).

    If the above code does not work, you can replace:

    $includes = substr(__( '(Includes %s)', 'woocommerce' ), 0, -3);

    by the first part of the actual text that you want to remove:

    $includes = 'including';

    Let me know if that helps!

    Ewout

    Thread Starter Tifoserie

    (@duemmler)

    Hi there,

    thanks a lot for your quick reply. unfortunately the modifications didnt bring any result.

    bur you are right. I am using German Market. So I will ask the author of that plugin

    Plugin Contributor Ewout

    (@pomegranate)

    Have you tried that second fix?
    That should work independently, but you do need to change the word ‘including’ (or better yet, only use the first characters).

    $includes = 'Enth';

    Thread Starter Tifoserie

    (@duemmler)

    hi there,

    I have tried all variations you mentioned but nothing changed. could it be that the problem is I use a customized template?

    <table class="order-details">
    	<thead>
    		<tr>
    			<th class="product"><?php _e('Product', 'wpo_wcpdf'); ?></th>
    			<th class="quantity"><?php _e('Quantity', 'wpo_wcpdf'); ?></th>
                <th class="price">Einzelpreis</th>
    			<th class="price"><?php _e('Price', 'wpo_wcpdf'); ?></th>
    		</tr>
    	</thead>
    	<tbody>
    		<?php $items = $wpo_wcpdf->get_order_items(); if( sizeof( $items ) > 0 ) : foreach( $items as $item_id => $item ) : ?>
    		<tr class="<?php echo apply_filters( 'wpo_wcpdf_item_row_class', $item_id, $wpo_wcpdf->export->template_type, $wpo_wcpdf->export->order ); ?>">
    			<td class="product">
    				<?php $description_label = __( 'Description', 'wpo_wcpdf' ); // registering alternate label translation ?>
    				<span class="item-name"><?php echo $item['name']; ?></span>
    				<?php do_action( 'wpo_wcpdf_before_item_meta', $wpo_wcpdf->export->template_type, $item, $wpo_wcpdf->export->order  ); ?>
    				<span class="item-meta"><?php echo $item['meta']; ?></span>
    				<dl class="meta">
    					<?php $description_label = __( 'SKU', 'wpo_wcpdf' ); // registering alternate label translation ?>
    					<?php if( !empty( $item['sku'] ) ) : ?><dt class="sku"><?php _e( 'SKU:', 'wpo_wcpdf' ); ?></dt><dd class="sku"><?php echo $item['sku']; ?></dd><?php endif; ?>
    					<?php if( !empty( $item['weight'] ) ) : ?><dt class="weight"><?php _e( 'Weight:', 'wpo_wcpdf' ); ?></dt><dd class="weight"><?php echo $item['weight']; ?><?php echo get_option('woocommerce_weight_unit'); ?></dd><?php endif; ?>
    				</dl>
    				<?php do_action( 'wpo_wcpdf_after_item_meta', $wpo_wcpdf->export->template_type, $item, $wpo_wcpdf->export->order  ); ?>
    			</td>
    			<td class="quantity"><?php echo $item['quantity']; ?></td>
                <td class="price"><?php echo $item['single_price']; ?></td>
    			<td class="price"><?php echo $item['price']; ?></td>
    		</tr>
    		<?php endforeach; endif; ?>
    	</tbody>
    	<tfoot>
    		<tr class="no-borders">
    			<td class="no-borders">
    				<div class="customer-notes">
    					<?php if ( $wpo_wcpdf->get_shipping_notes() ) : ?>
    						<h3><?php _e( 'Customer Notes', 'wpo_wcpdf' ); ?></h3>
    						<?php $wpo_wcpdf->shipping_notes(); ?>
    					<?php endif; ?>
    				</div>
    			</td>
    			<td class="no-borders" colspan="3">
    				<table class="totals">
    					<tfoot>
    						<?php foreach( $wpo_wcpdf->get_woocommerce_totals() as $key => $total ) : ?>
    						<tr class="<?php echo $key; ?>">
    							<td class="no-borders"></td>
    							<th class="description"><?php echo $total['label']; ?></th>
    							<td class="price"><span class="totals-price"><?php echo $total['value']; ?></span></td>
    						</tr>
    						<?php endforeach; ?>
    					</tfoot>
    				</table>
    			</td>
    		</tr>
    	</tfoot>
    </table>
    Plugin Contributor Ewout

    (@pomegranate)

    Hi!
    The template customization shouldn’t make any difference in the totals.

    The only thing I can think of, is that German market is using the same filter and applies the text after you run the above filter. It’s also possible that I have not been entirely clear about what the filter should look like. If you follow my last advice (tested on my own site, although not with German Market), the full filter looks like this (make sure that ‘enth’ is exacly the same, so if it has a capital E, use a capital in the filter too):

    add_filter( 'wpo_wcpdf_woocommerce_totals', 'wpo_wcpdf_remove_includes' );
    function wpo_wcpdf_remove_includes ( $totals ) {
    	if ( isset($totals['shipping'])) {
    		$value = $totals['shipping']['value'];
    		$includes = 'enth';
    		$totals['shipping']['value'] = ($pos = strpos($value, ' '.$includes)) ? substr($value, 0, $pos) : $value;
    	}
    	return $totals;
    }

    If that doesn’t work, you can try a higher priority (999), to rule out that German market is using the same filter:

    add_filter( 'wpo_wcpdf_woocommerce_totals', 'wpo_wcpdf_remove_includes', 999);
    function wpo_wcpdf_remove_includes ( $totals ) {
    	if ( isset($totals['shipping'])) {
    		$value = $totals['shipping']['value'];
    		$includes = 'enth';
    		$totals['shipping']['value'] = ($pos = strpos($value, ' '.$includes)) ? substr($value, 0, $pos) : $value;
    	}
    	return $totals;
    }

    Hope that helps ??

    Ewout

    Plugin Contributor Ewout

    (@pomegranate)

    @duemmler, did you try the above, or did you find another solution?

    Thread Starter Tifoserie

    (@duemmler)

    Hi, sorry for my delayed reply.

    I solved the problem with this code:

    // Product line items: price only
    add_filter(
    	'wgm_checkout_add_tax_to_product_item',
    	function ( $item, $amount, $tax, $tax_display, $tax_label, $tax_amount, $tax_decimals, $tax_rate_formatted ) {
    		if ( isset($totals['shipping']) ) {
    			$item = $amount; // removed tax from output
    		}
    
    		return $item;
    	}, 10, 8 );
    
    // Shipping costs: empty string for taxes
    add_filter( 'wgm_get_split_tax_html', '__return_empty_string' );
    
    // Order total: empty string for taxes
    add_filter( 'wgm_get_totals_tax_string', '__return_empty_string' );

    the authors of German Maket give me the hint

    Plugin Contributor Ewout

    (@pomegranate)

    Awesome – thanks for sharing!

    Have a great day!

    Ewout

Viewing 8 replies - 1 through 8 (of 8 total)
  • The topic ‘hide taxes in shipping cost’ is closed to new replies.