Cartkit kirby v3

I’m trying to make the cartkit plugin works for kirby 3. What I don’t understand is how to convert this file plugin made for v2 into v3.

This file contains only multiple functions, I don’t know what kind of extension types I have to use in that case. My last try is to run them into a simple snippet like


Kirby::plugin('oj/cart', [
	'snippets'     => [
		'cart' => __DIR__ . '/snippets/cartsnippet.php'

with all the functions into cartsnippet.php, but I get blank pages, that’s why I’m here to ask you where I’m wrong :slight_smile:

Functions remain functions, there is nothing to convert. But you have to move them outside the plugin wrapper. You cannot move them into a snippet.

Thanks for the clarification. My goal was to set these functions into an external file to clean my template, but it’s ok.

You can do that, then you have to require the external file. But why in the template? I thought you were using this in a plugin? What I meant, this goes either into the main plugin file (index.php) or into a separate script file you require in index.php. Putting these functions into a template will definitely be a mess.

1 Like