Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Script to clean up the purchased items table on a storefront checkout page
<!-- BEGIN clean up totals in the storefront checkout page -->
<script type="text/javascript">
$(document).ready(function() {
// Clean up the totals in the storefont checkout invoice.
// @see https://help.salsalabs.com/hc/en-us/community/posts/213571707
//
if (RegExp('shop/checkOut.jsp').test(window.location.href)) {
// Put an ID on the table so that it can be decorated with CSS.
//
var t = $('td[colspan=3]:contains("Subtotal:")').parent().parent()
t.parent().attr('id', 'payment-table');
// Remove all dollar signs.
//
t.html(t.html().replace(/\$/g, ''))
// Missing cell at the end of the column head line.
//
t.find('tr').eq(0).append('<td></td>')
// Line up total cells with the amounts
//
t.find('td[colspan=3]').attr('colspan', '4');
// Add a cell after subtotal/shipping/display cell in total rows.
//
$.each('sub shipping amountDisplay'.split(' '), function(i, n) {
$('input[name=' + n + ']').parent().after('<td></td>');
})
}
});
</script>
<!-- END clean up totals in the storefront checkout page -->
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.