I need to make the code snippet work.In file magento\app\design\frontend\Webkul\agorae\Magento_Wishlist\templates\catalog\product\view\addto\wishlist.phtml

Code snippet

Code taken from path


echo $block->getItemRemoveParams($block->getItem()); ?>' title="@escapeNotVerified */ echo __('Remove Item') ?>" class="btn-remove action >delete">

For some reason item object


seems not working

I need to use above code snippet in file


I have included the required block to make above code snippet work.

my code in wishlist.phtml

        $blockObjx = $block->getLayout()->createBlock('Magento\Wishlist\Block\AbstractBlock');

        // echo $productID . gettype($productID);

        // echo $blockObjx->getRemoveParams((object)$productID);

        // // echo $blockObjx->getItemRemoveParams($blockObjx->getItem());

        // exit;

    <a href="#" class="action towishlist" data-role="remove" data-post-remove='<?php echo $blockObjx->getItemRemoveParams($product); ?>' title="<?php /* @escapeNotVerified */ echo __('Remove Item') ?>" class="btn-remove action delete">
        <span><?php echo __('Remove from Wish List');?></span>

Do I need any missing js to remove the items from wishlist after clicking ?

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.