The postAddProductToCollection
hook is triggered after a product is added to the cart and can be used to perform additional actions.
\Isotope\Model\ProductCollectionItem $product
The product collection item that was added to the collection.
int $quantity
The quantity of the product that was added to the collection.
\Isotope\Interfaces\IsotopeProductCollection $collection
The collection the product was added to.
array $config
The model configuration.
// 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 …
}
}