Merx – Plugin to create online shops with Kirby 3

Hello @tobiasfabian I’m having this same issue but when a customer is placing the order.
I’ve been using merx on this website for a few months and processing a good amount of orders. Recently, customers started to get this message on the checkout page when processing the payment (using Stripe) somehow this is resulting on having duplicate orders and duplicate payments.
It seems customers are sending again the payment, not sure.
Any help is really appreciated, my client wants to kill me :sweat_smile:

Hey @ponchoelastic,

I don’t quite understand the problem you are having. Can you try to describe it in more detail?

Generally speaking, an order page is created only when the (Stripe) payment is completed. When a checkout is not successful there shouldn’t be an order page.

Apologies for my bad explanation. Hope this one is better
Customers are paying with Stripe and orders are being created. But instead of being redirected to success page they are getting the “Sorting number of a complete order cannot be changed.” error in the checkout page.
For some reason, some orders are duplicated. I think this could be due customers when getting the error are pressing again the “pay” button.


@ponchoelastic did you read my issue at github?: Severe errors after deleting orders (Sorting number of a complete order cannot be changed) · Issue #28 · wagnerwagner/merx · GitHub

Hey @ponchoelastic,
thanks for your clarification.

It is difficult to tell where the error comes from, especially since it seems to occur only occasionally.

  • Can you reproduce the error (on a local test environment)?
  • Can you check all orders pages. They should be in an ascending order (e.g. 1_gopk3fopeds9qzg7, 2_j7hrrknijogdrzl6, etc.).
  • Is it happening only with Stripe payments? When the customers pressing the pay button again, do they use another payment method?
  • Do you have hooks that change order pages?

Looking into this. Thank you both. cc @plagasul
I just removed an order with the same sorting number than other. So waiting to see if this was causing the issue.

Hi folks,

I´m currently trying to integrate product variants. What is the correct content structre when every product variation is an own product?
My goal is to have a product page with a dropdown of the variants.

Hey @mafleig,

thanks for your question.
We have a brand new Starterkit wich includes – wait for it – a product page with variants:

Here is the source code:

Feel free to use the Starterkit and customize it to your needs.

1 Like

Wow, this is so awesome :heart_eyes:
Thanks a lot, @tobiasfabian !

Merx looks amazing!

I’m working on a store that sells subscriptions via a Stripe.

@tobiasfabian do you have any experience incorporating subscriptions into a previous Merx project?

I think the most elegant way might be to either extend the product page with data related to the billing cycle… or potentially to extend Merx to support a Subscription template in addition to a Product template? Down the road there are also considerations around keeping track of the status of a customer’s subscription, e.g. perhaps via webhooks that are called every time the status changes…

Would you be open to PRs or contributions to better support subscriptions in Merx?

I get this error after uploading my website:


        if ($this->useIncludePath && $file = stream_resolve_include_path($logicalPathPsr0)) {
            return $file;
        return false;
 * Scope isolated include.
 * Prevents access to $this/self from included files.
 * @param  string $file
 * @return void
 * @private
function includeFile($file)
    include $file;

Locally everything is running fine. And it ran before updating the website (no updates related to Merx) as well. Anyone seen this before?

Hey @s3ththompson,

I have not done this yet. Maybe it is already possible with the current state of Merx. I think it depends on how you want to integrate this – there could be several options.

I am not sure about the payment provider. Maybe you need to charge a credit card once a year. I think this is possible with Stripe, but I’m not sure what needs to be submitted to Stripe from your website/Merx. Maybe some adjustments need to be made on the Merx side.

If there are only minor adjustments to Merx, e.g. in the payment flow, I’m open to integrating this (and would appreciate PRs), but to be honest, if there is a need for more fundamental changes, I’d refuse the support of subscriptions because we do not have the capacity to do so at the moment – sorry.

Hey @Zaptronic,

have you already solved the problem? It is somehow related to Composer. Did you installed Kirby and Merx with composer? Have you tried to reinstall all Composer dependencies (make sure to delete the Kirby, Merx and vendor folders)?

No I didn’t install Merx with composer.

This is a composer error. Are you sure it’s related to Merx?

I recommend to double check your Composer settings and compare them to your local files. Reinstalling Composer dependencies might help.

Would anyone in this forum have any ideas about how to implement a product with Merx that has variable pricing? For example if you wanted to use a ‘Pay what you want’ or donation system where you let the customer specify the price? I’m peeking my head into the ProductList class but its a bit beyond my knowledge how to modify the price value in the cart based on a dynamic form input in the front end. Thanks

Hey @rhjp , not so sure, but I think you can give the price as argument to $cart->add().

With JS and fetch, you could get the form input and call an endpoint you specify in your config.php or in a plugin to add the product with the price from the input.

Take a look at the code of the Merx Starterkit, the cart.js contains code that could be useful for you.

Hello! I would like to know how to deal (or circumvent) with negative sums in the cart.

I have the following hooks in my config:

'ww.merx.cart' => function ($cart) {
    if ($cart->count() > 0) {
            if ($cart->get('frp/travelcosts')) {
                            'id' => 'traveldiscount',
            if (!$cart->get('frp/travelcosts')) {
            if ($cart->get('frp/onlinegalleryplus')) {
                    $cart->remove('frp/onlinegallery') && $cart->remove('frp/contactsheets');

This is the route:

    'pattern' => 'remove',
    'method' => 'post',
    'action' => function() {
            $id = get('id');
            $uid = get('uid');
            try {
            } catch(Exception $ex) {
            return $ex->getMessage();

First and third hook are working fine.

The second hook is not working when:

  1. travelcosts with traveldiscount are the only items in the cart
  2. travelcosts with traveldiscount are added first to the cart and then adding more items

Both throws the exception “The sum of the cart must not be negative” - even if the sum of the cart is not negative after removing both because there are a lot more items in the cart with a higher sum.

The second hook is only working when I add another item first (and the sum of the cart is higher as both travelcosts and traveldiscount of course).

Any ideas how to deal with that? What do I miss?
Thank you!


awesome plugin! We are currently evaluating it for a customer who sells beverages. I have a few questions:

  1. Is there a way to check - before the order is placed - that the cart article count is divisible by 6 since our customer only ships in packages with 6 or 12 bottles …?

  2. Also would it be possible to calculate shipping based on that cart article count?
    Shipping is 8 EUR, except when the total article count is 18 - then shipping would be free.

  3. Payment by invoice would be the only payment option. Is it possible to remove the payment selection in the cart or have “Invoice” as the preselected and only choice?

Thank you!