1

I'm using magento 2.3.4 and i tried to generate a delete cart item like this in phtml file:

    <?php $formKey =  $this->helper('Vendore\Module\Helper\Data')->getFormKey() ?>
    <a href="<?php echo $this->getUrl('checkout/cart/delete',array('form_key'=>$formKey,'id'=>$_item->getId())) ?>" title="<?= __("Remove Item") ?>" class="btn-remove btn-remove2"> <?= __("Remove Item") ?> </a>

the $formKey is retrieved successfully, but when I clicked the link it redirects me to 404 page

  • you need to add form key into your form not in URL. – Msquare Jun 19 at 5:28

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.