Modify Virtual Pages while keeping them virtual - Page Methods

I have been trying to use a virtual page within a session to somewhat make use the page methods to modify the data within the session however i quickly noticed that once i am doing any sort of modification such as $page->update() the virtual page gets written to disk.

my thought has been (in the example of having a shopping cart with sessions) to be

  • create virtual page which is essentially the session / shopping cart informations e.g. structure for products
  • when adding a product to cart the virtual page is read and updated accordingly
  • save the session again
  • somewhere during checkout the virtual page will be moved/created as a physical page

so i have only made some dirty tests to see if this could work and saw the page gets written to disk when using the update method.

// Setting up the session
$session = $kirby->session();
if(!$session->get('shop.cart')){
    $random = Kirby\Toolkit\Str::random('24','alpha');
    $virtualorder = new Page([
        'slug' => $random,
        'template' => 'shop-order',
        'content' => [
            'title' => 'Example Order',
            'text' => '',
        ]
    ]);
    $session->set('shop.cart', $virtualorder);
} 

The above seems to do as intended, when later accessing the virtual page, i will need the impersonate, to then use update, but at that stage, it gets written to disk.

if($page = $session->get('shop.cart')){
    kirby()->impersonate('kirby');
    $page->update(['title' => 'test123','number' => 1]);
}
dump($page);

While the $page is correctly updated, it got written to disk, i would like it to retain being a virtual page, is there a possibility, or will i have to get back working with other types of data structures?

my first attempt has been, working with draft pages which would slow down after some time if there are too many draft/subpages overall as discussed here: