Remove subtotal line from cart and checkout pages in Woocommerce
I want to remove the Subtotals from Cart, Checkout, Order Received, Order Details and the emails. I don't want to use CSS, as it won't remove the reference from the order details page and emails. I have tried this code:
add_filter( 'woocommerce_get_order_item_totals', 'adjust_woocommerce_get_order_item_totals' );
function adjust_woocommerce_get_order_item_totals( $totals )
unset($totals['cart_subtotal'] );
return $totals;
It isn't working, the Subtotal is visible on the Cart and Checkout pages.
Is there any other function or do I have to create a separate woocommerce folder under my active theme and delete any reference of "Subtotal" from the templates.
php templates woocommerce cart checkout
add a comment |
I want to remove the Subtotals from Cart, Checkout, Order Received, Order Details and the emails. I don't want to use CSS, as it won't remove the reference from the order details page and emails. I have tried this code:
add_filter( 'woocommerce_get_order_item_totals', 'adjust_woocommerce_get_order_item_totals' );
function adjust_woocommerce_get_order_item_totals( $totals )
unset($totals['cart_subtotal'] );
return $totals;
It isn't working, the Subtotal is visible on the Cart and Checkout pages.
Is there any other function or do I have to create a separate woocommerce folder under my active theme and delete any reference of "Subtotal" from the templates.
php templates woocommerce cart checkout
add a comment |
I want to remove the Subtotals from Cart, Checkout, Order Received, Order Details and the emails. I don't want to use CSS, as it won't remove the reference from the order details page and emails. I have tried this code:
add_filter( 'woocommerce_get_order_item_totals', 'adjust_woocommerce_get_order_item_totals' );
function adjust_woocommerce_get_order_item_totals( $totals )
unset($totals['cart_subtotal'] );
return $totals;
It isn't working, the Subtotal is visible on the Cart and Checkout pages.
Is there any other function or do I have to create a separate woocommerce folder under my active theme and delete any reference of "Subtotal" from the templates.
php templates woocommerce cart checkout
I want to remove the Subtotals from Cart, Checkout, Order Received, Order Details and the emails. I don't want to use CSS, as it won't remove the reference from the order details page and emails. I have tried this code:
add_filter( 'woocommerce_get_order_item_totals', 'adjust_woocommerce_get_order_item_totals' );
function adjust_woocommerce_get_order_item_totals( $totals )
unset($totals['cart_subtotal'] );
return $totals;
It isn't working, the Subtotal is visible on the Cart and Checkout pages.
Is there any other function or do I have to create a separate woocommerce folder under my active theme and delete any reference of "Subtotal" from the templates.
php templates woocommerce cart checkout
php templates woocommerce cart checkout
edited Nov 14 '18 at 2:17
LoicTheAztec
85.4k136095
85.4k136095
asked Nov 13 '18 at 9:35
mesumosumesumosu
509
509
add a comment |
add a comment |
1 Answer
1
active
oldest
votes
1) For All orders pages and email notifications (Order received, Order pay, Order view and emails)
Your code works and remove the subtotal line from totals lines:
add_filter( 'woocommerce_get_order_item_totals', 'remove_subtotal_from_orders_total_lines', 100, 1 );
function remove_subtotal_from_orders_total_lines( $totals )
unset($totals['cart_subtotal'] );
return $totals;
Code goes in function.php file of your active child theme (active theme). Tested and works.
2) For cart and checkout pages:
You need to create a separate "woocommerce" folder under your active theme for the following templates:
For cart - cart/cart-totals.php
| remove the code block from line 32 to 35:
<tr class="cart-subtotal">
<th><?php _e( 'Subtotal', 'woocommerce' ); ?></th>
<td data-title="<?php esc_attr_e( 'Subtotal', 'woocommerce' ); ?>"><?php wc_cart_totals_subtotal_html(); ?></td>
</tr>
For checkout - checkout/review-order.php
| remove the code block from line 58 to 61:
<tr class="cart-subtotal">
<th><?php _e( 'Subtotal', 'woocommerce' ); ?></th>
<td><?php wc_cart_totals_subtotal_html(); ?></td>
</tr>
Save both templates… You are done.
add a comment |
Your Answer
StackExchange.ifUsing("editor", function ()
StackExchange.using("externalEditor", function ()
StackExchange.using("snippets", function ()
StackExchange.snippets.init();
);
);
, "code-snippets");
StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "1"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);
else
createEditor();
);
function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);
);
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53277895%2fremove-subtotal-line-from-cart-and-checkout-pages-in-woocommerce%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
1) For All orders pages and email notifications (Order received, Order pay, Order view and emails)
Your code works and remove the subtotal line from totals lines:
add_filter( 'woocommerce_get_order_item_totals', 'remove_subtotal_from_orders_total_lines', 100, 1 );
function remove_subtotal_from_orders_total_lines( $totals )
unset($totals['cart_subtotal'] );
return $totals;
Code goes in function.php file of your active child theme (active theme). Tested and works.
2) For cart and checkout pages:
You need to create a separate "woocommerce" folder under your active theme for the following templates:
For cart - cart/cart-totals.php
| remove the code block from line 32 to 35:
<tr class="cart-subtotal">
<th><?php _e( 'Subtotal', 'woocommerce' ); ?></th>
<td data-title="<?php esc_attr_e( 'Subtotal', 'woocommerce' ); ?>"><?php wc_cart_totals_subtotal_html(); ?></td>
</tr>
For checkout - checkout/review-order.php
| remove the code block from line 58 to 61:
<tr class="cart-subtotal">
<th><?php _e( 'Subtotal', 'woocommerce' ); ?></th>
<td><?php wc_cart_totals_subtotal_html(); ?></td>
</tr>
Save both templates… You are done.
add a comment |
1) For All orders pages and email notifications (Order received, Order pay, Order view and emails)
Your code works and remove the subtotal line from totals lines:
add_filter( 'woocommerce_get_order_item_totals', 'remove_subtotal_from_orders_total_lines', 100, 1 );
function remove_subtotal_from_orders_total_lines( $totals )
unset($totals['cart_subtotal'] );
return $totals;
Code goes in function.php file of your active child theme (active theme). Tested and works.
2) For cart and checkout pages:
You need to create a separate "woocommerce" folder under your active theme for the following templates:
For cart - cart/cart-totals.php
| remove the code block from line 32 to 35:
<tr class="cart-subtotal">
<th><?php _e( 'Subtotal', 'woocommerce' ); ?></th>
<td data-title="<?php esc_attr_e( 'Subtotal', 'woocommerce' ); ?>"><?php wc_cart_totals_subtotal_html(); ?></td>
</tr>
For checkout - checkout/review-order.php
| remove the code block from line 58 to 61:
<tr class="cart-subtotal">
<th><?php _e( 'Subtotal', 'woocommerce' ); ?></th>
<td><?php wc_cart_totals_subtotal_html(); ?></td>
</tr>
Save both templates… You are done.
add a comment |
1) For All orders pages and email notifications (Order received, Order pay, Order view and emails)
Your code works and remove the subtotal line from totals lines:
add_filter( 'woocommerce_get_order_item_totals', 'remove_subtotal_from_orders_total_lines', 100, 1 );
function remove_subtotal_from_orders_total_lines( $totals )
unset($totals['cart_subtotal'] );
return $totals;
Code goes in function.php file of your active child theme (active theme). Tested and works.
2) For cart and checkout pages:
You need to create a separate "woocommerce" folder under your active theme for the following templates:
For cart - cart/cart-totals.php
| remove the code block from line 32 to 35:
<tr class="cart-subtotal">
<th><?php _e( 'Subtotal', 'woocommerce' ); ?></th>
<td data-title="<?php esc_attr_e( 'Subtotal', 'woocommerce' ); ?>"><?php wc_cart_totals_subtotal_html(); ?></td>
</tr>
For checkout - checkout/review-order.php
| remove the code block from line 58 to 61:
<tr class="cart-subtotal">
<th><?php _e( 'Subtotal', 'woocommerce' ); ?></th>
<td><?php wc_cart_totals_subtotal_html(); ?></td>
</tr>
Save both templates… You are done.
1) For All orders pages and email notifications (Order received, Order pay, Order view and emails)
Your code works and remove the subtotal line from totals lines:
add_filter( 'woocommerce_get_order_item_totals', 'remove_subtotal_from_orders_total_lines', 100, 1 );
function remove_subtotal_from_orders_total_lines( $totals )
unset($totals['cart_subtotal'] );
return $totals;
Code goes in function.php file of your active child theme (active theme). Tested and works.
2) For cart and checkout pages:
You need to create a separate "woocommerce" folder under your active theme for the following templates:
For cart - cart/cart-totals.php
| remove the code block from line 32 to 35:
<tr class="cart-subtotal">
<th><?php _e( 'Subtotal', 'woocommerce' ); ?></th>
<td data-title="<?php esc_attr_e( 'Subtotal', 'woocommerce' ); ?>"><?php wc_cart_totals_subtotal_html(); ?></td>
</tr>
For checkout - checkout/review-order.php
| remove the code block from line 58 to 61:
<tr class="cart-subtotal">
<th><?php _e( 'Subtotal', 'woocommerce' ); ?></th>
<td><?php wc_cart_totals_subtotal_html(); ?></td>
</tr>
Save both templates… You are done.
edited Nov 14 '18 at 2:31
answered Nov 14 '18 at 2:16
LoicTheAztecLoicTheAztec
85.4k136095
85.4k136095
add a comment |
add a comment |
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53277895%2fremove-subtotal-line-from-cart-and-checkout-pages-in-woocommerce%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown