components()->has('ShoppingCart')) { $this->loadComponent('CakeCarts.ShoppingCart', [ // This is default config. You can modify "actions" as needed to make // component work only for specified methods. 'actions' => true, ]); } } /** * Index method * * @return \Cake\Http\Response|null|void Renders view */ public function index() { // use cart from beforeFilter } }