Magento – Checkout cart remove item not updating

cartcheckoutmagento-1.9

I've taken over a project from someone else and am having trouble fixing a bug on the checkout/cart page. When an item is added and you're redirected to domain.com/checkout/cart when you try to remove the item, the page seems to reload but the item is still there until you manually refresh. Sometimes have the same issue with adding an item, won't appear until you refresh the page.

I've tried debugging in app/design/frontend/rwd/<theme>/template/checkout/cart.phtml but when trying to var_dump($this->getItems()) the page hangs and eventually crashes. I'm trying to see at what point the system recognises that items have been added/removed. How else can I go about outputting the items currently in the cart?

I have the other code that is generally linked to update not working

<?php echo $this->getMessagesBlock()->getGroupedHtml() ?>
<?php echo $this->getChildHtml('form_before') ?>
<form action="<?php echo $this->getUrl('checkout/cart/updatePost') ?>" method="post">
    <?php echo $this->getBlockHtml('formkey'); ?>

It seems to be able to retrieve getItems() but unable to dump the returned data.

<?php foreach($this->getItems() as $_item): ?>
    <?php echo $this->getItemHtml($_item) ?>
<?php endforeach ?>

Best Answer

So after debugging every single cache possible it actually turned out to be browser caching the site, this was happening for everybody that visited the site, why I still have no idea.

I added the following in .htaccess which seems to have resolved the issue

<FilesMatch "\.(html|htm|js|css|php)>
    FileETag None
    Header unset ETag
    Header set Cache-Control "max-age=0, no-cache, no-store, must-revalidate"
    Header set Pragma "no-cache"
    Header set Expires "Wed, 11 Jan 1984 05:00:00 GMT"
</FilesMatch>