Merx

Wishlist

Using productList to create a wishlist.

Create new list

use Wagnerwagner\Merx;

$productList = new ProductList();

Add product

$productList->add([
  'id' => 'nice-shoes',
  'added' => date('c'),
]);

Make sure id is a valid product page id.

Save list

You may want to save the users wish list. Let’s assume you don’t have a user management so you have to save the list into the users session.

kirby()->session()->set('wishlist', $productList->toArray());