4

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

magento2\vendor\magento\module-wishlist\view\frontend\templates\item\column

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

For some reason item object

$block->getItem() 

seems not working

I need to use above code snippet in file

magento\app\design\frontend\Webkul\agorae\Magento_Wishlist\templates\catalog\product\view\addto

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

my code in wishlist.phtml

<?php 
        $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>
    </a>

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.