3 added 486 characters in body
source | link

I need to change add to cart success message after adding product into cart through plugin.

Currently i have used below code for override cart method and its working fine.

<preference for="Magento\Checkout\Controller\Cart\Add" type="CustomPackage\Checkout\Controller\Magento\Checkout\Cart\Add" />

but i need to go through plugin so how can i do that ? I seen some documentation and in plugin its used aroundExecute method.

so i don't understand that how my code execute without use Add method ? and how can i edit success message ?

I need to below message :

    $message = __('This Product has been added to your Shopping Cart. 
    Click here to view your <a href="%1">Shopping Cart</a>. 
    or you can <a href="%2">Continue Shopping.</a> <a href="javascript:void(0);" class="close-message">close</span>', $this->_objectManager->get('Magento\Checkout\Helper\Cart')->getCartUrl(),$this->_storeManager->getStore()->getBaseUrl());
    $this->messageManager->addSuccess($message);

any idea please share.

I need to change add to cart success message after adding product into cart through plugin.

Currently i have used below code for override cart method and its working fine.

<preference for="Magento\Checkout\Controller\Cart\Add" type="CustomPackage\Checkout\Controller\Magento\Checkout\Cart\Add" />

but i need to go through plugin so how can i do that ? I seen some documentation and in plugin its used aroundExecute method.

so i don't understand that how my code execute without use Add method ? and how can i edit success message ?

any idea please share.

I need to change add to cart success message after adding product into cart through plugin.

Currently i have used below code for override cart method and its working fine.

<preference for="Magento\Checkout\Controller\Cart\Add" type="CustomPackage\Checkout\Controller\Magento\Checkout\Cart\Add" />

but i need to go through plugin so how can i do that ? I seen some documentation and in plugin its used aroundExecute method.

so i don't understand that how my code execute without use Add method ? and how can i edit success message ?

I need to below message :

    $message = __('This Product has been added to your Shopping Cart. 
    Click here to view your <a href="%1">Shopping Cart</a>. 
    or you can <a href="%2">Continue Shopping.</a> <a href="javascript:void(0);" class="close-message">close</span>', $this->_objectManager->get('Magento\Checkout\Helper\Cart')->getCartUrl(),$this->_storeManager->getStore()->getBaseUrl());
    $this->messageManager->addSuccess($message);

any idea please share.

2 add new tags
| link
1
source | link

Magento 2 : I need to change add to cart success message after adding product into cart through plugin

I need to change add to cart success message after adding product into cart through plugin.

Currently i have used below code for override cart method and its working fine.

<preference for="Magento\Checkout\Controller\Cart\Add" type="CustomPackage\Checkout\Controller\Magento\Checkout\Cart\Add" />

but i need to go through plugin so how can i do that ? I seen some documentation and in plugin its used aroundExecute method.

so i don't understand that how my code execute without use Add method ? and how can i edit success message ?

any idea please share.