postAddProductToCollection
The postAddProductToCollection hook is triggered after a product is added to the cart and can be used to perform additional actions.
Parameters
-
\Isotope\Model\ProductCollectionItem
$productThe product collection item that was added to the collection.
-
int
$quantityThe quantity of the product that was added to the collection.
-
\Isotope\Interfaces\IsotopeProductCollection
$collectionThe collection the product was added to.
-
array
$configThe model configuration.
Example
// src/EventListener/Isotope/PostAddProductToCollectionListener.php
namespace App\EventListener\Isotope;
use Isotope\Interfaces\IsotopeProduct;
use Isotope\Interfaces\IsotopeProductCollection;
use Isotope\ServiceAnnotation\IsotopeHook;
/**
* @IsotopeHook("postAddProductToCollection")
*/
class PostAddProductToCollectionListener
{
public function __invoke(ProductCollectionItem $item, $quantity, IsotopeProductCollection $collection, array $config): void
{
// Do something …
}
}