• Resolved andi0tx

    (@andi0tx)


    Hi,

    I have a problem when editing the simple template. I need to display different things/have a different layout for the tabel footer, so I removed the full <tfoot></tfoot> and replaced it with the <tfoot></tfoot> section from Woo’s review-order.php along with an added table row that I need due to legislation in my country,
    But this is not working, instead of displaying the table foot like on the checkout page it is simply displaying subotal and total.

    What do I need to change?
    Thank you!

Viewing 6 replies - 1 through 6 (of 6 total)
  • Plugin Contributor alexmigf

    (@alexmigf)

    Hello @andi0tx

    The default <tfoot> has a specific code to print the totals, if you removed them they should not be shown.

    About the new code you pasted, could you share it here please?

    Thread Starter andi0tx

    (@andi0tx)

    <tfoot>
    
    		<tr class="cart-subtotal">
    			<th><?php esc_html_e( 'Subtotal', 'woocommerce' ); ?></th>
    			<td><?php wc_cart_totals_subtotal_html(); ?></td>
    		</tr>
    
    		<?php foreach ( WC()->cart->get_coupons() as $code => $coupon ) : ?>
    			<tr class="cart-discount coupon-<?php echo esc_attr( sanitize_title( $code ) ); ?>">
    				<th><?php wc_cart_totals_coupon_label( $coupon ); ?></th>
    				<td><?php wc_cart_totals_coupon_html( $coupon ); ?></td>
    			</tr>
    		<?php endforeach; ?>
    
    		<?php if ( WC()->cart->needs_shipping() && WC()->cart->show_shipping() ) : ?>
    
    			<?php wc_cart_totals_shipping_html(); ?>
    
    		<?php endif; ?>
    
    		<?php foreach ( WC()->cart->get_fees() as $fee ) : ?>
    			<tr class="fee">
    				<th><?php echo esc_html( $fee->name ); ?></th>
    				<td><?php wc_cart_totals_fee_html( $fee ); ?></td>
    			</tr>
    		<?php endforeach; ?>
    
    		<?php if ( wc_tax_enabled() && ! WC()->cart->display_prices_including_tax() ) : ?>
    			<?php if ( 'itemized' === get_option( 'woocommerce_tax_total_display' ) ) : ?>
    				<?php foreach ( WC()->cart->get_tax_totals() as $code => $tax ) : // phpcs:ignore WordPress.WP.GlobalVariablesOverride.OverrideProhibited ?>
    					<tr class="tax-rate tax-rate-<?php echo esc_attr( sanitize_title( $code ) ); ?>">
    						<th><?php echo esc_html( $tax->label ); ?></th>
    						<td><?php echo wp_kses_post( $tax->formatted_amount ); ?></td>
    					</tr>
    				<?php endforeach; ?>
    			<?php else : ?>
    				<tr class="tax-total">
    					<th><?php echo esc_html( WC()->countries->tax_or_vat() ); ?></th>
    					<td><?php wc_cart_totals_taxes_total_html(); ?></td>
    				</tr>
    			<?php endif; ?>
    		<?php endif; ?>
    
    <tr class="custom-tax-total">
    					<th><?php echo esc_html( WC()->countries->tax_or_vat() ); ?></th>
    					<td><?php wc_cart_totals_taxes_total_html(); ?></td>
    				</tr>
    		<tr class="order-total">
    			<th><?php esc_html_e( 'Total', 'woocommerce' ); ?></th>
    			<td><?php wc_cart_totals_order_total_html(); ?></td>
    		</tr>
    
    	</tfoot>
    Plugin Contributor Ewout

    (@pomegranate)

    This code is for the frontend, reading data from the cart. Once the order is placed, the cart for that order is gone. So you need to read from the order data instead.

    Unfortunately we cannot provide you with code customization like this, but if you want to modify the order totals and define which rows should be shown where and with what prices, we have the Premium Templates extension that lets you do this via a visual customizer

    Thread Starter andi0tx

    (@andi0tx)

    I understand. Could you maybe let me know though how to remove the payment method in the tfoot? As this is displayed above the table I don’t need it in the foot again.

    Thanks!

    Plugin Contributor alexmigf

    (@alexmigf)

    Hello @andi0tx

    By default the payment method is not showed there, i suppose you add it there.

    Thread Starter andi0tx

    (@andi0tx)

    Ah, my mistake. Thanks for your help!

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘Editing template’ is closed to new replies.