Merx – Plugin to create online shops with Kirby 3

I think it is because of this line in the plugin merx/composer.json at main · wagnerwagner/merx · GitHub.

It may well work fine with Kirby 4 though, if edit that line and run composer upgrade, but might be best to wait a release of Merx that has been tested with Kirby 4.

Hello,
I’m trying to integrate Merx starterkit into a website. I’m also using webpack.
I’m getting this error : No route found for path: "shop/cart" and request method: "GET", I tried to change my /api/shop/${endpoint} to http://localhost:3000/api/shop/${endpoint} in my cart.js but that doesn’t work. Is this related to webpack’s files structure ?
Thanks a lot.

Hello @Vernone,

do you have the site plugin in your plugins directory?

Hi!

I’m trying to implement the Merx shop in an existing headless Kirby (v4). For context: I need one backend to store content for multiple subsites/projects. This includes a webshop which ideally can be build with Nuxt as frontend.

But Now I’m figuring out how Merx would would work in this setup… What I’m currently thinking about doing:

  • Add-to-cart adds the product/quantity as an object to cookies/localstorage in the frontend app.
  • When going to checkout I collect the data from the cookies/localstorage and proceed to the checkout.

I’ve figured out that if i fetch (post) the data to the cart via a custom api which returns cart()->add('theFormData') the data will be returned, but when the page is refreshed it’s gone. Thus my conclusion is to store it as cookie and handling the cart-data there before sending this collected data to the checkout (which I still need to figure out).

Anyone that can point me in the right direction? I’m struggling to understand the docs for this kind of approach.

Sorry to dig out old posts: I’m currently trying to make this one run (create a Dicount code Form) but couldn’t figure it out yet.

I created a Discount Product with a code and discount field and the form on my checkout page looks like this:

<form name="promoform">
<input type="text" placeholder="Gutscheincode" name="promocode">
<button type="submit" name="submit" class="button">Gutscheincode Einlösen</button>
</form>

In my site/config/config.php I basically used the code by @tobiasfabian but I seem to struggle with the placement of the functions. Or are there other files I have to edit?

Hi @tobiasfabian

I would like to second @mafleig 's question. I’m thinking about including a discount code in the starter kit, but I don’t understand what steps would be necessary in order to do that. The link to the example shop no longer works btw.

So the first question is: Will the starter kit perhaps get an update with the discount code soon?

If not, could you maybe provide some steps (for dummies like me) which changes would be necessary and maybe how the config of the Starterkit would look after implementing the above code?

Thank you so much!
Carola

Hi @mafleig and @neongrau,

I created a new branch of merx-starterkit with an implementation of coupons:

2 Likes

Thanks so much :smiling_face_with_three_hearts: Does this solution work with percentage based discounts, too?

Hi @tobiasfabian,

Amazing, thank you so much!

Happy easter!

PS.: I just implemented it in the most basic way (still: yay!) and wanted to report a minor issue: when the code has been redeemed, but the quantity for some reason is set back to zero, an error is thrown like this: “The sum of the cart must not be negative.”

I’m setting up a store with Stripe following the cookbook: Checkout with Stripe’s Payment Intents – Merx
Payment is successful but I get the following error. ‘Wagnerwagner\Merx\Merx::completePayment(): Return value must be of type OrderPage, Kirby\Cms\Page returned’. And I just can’t find any clue where to look or how to fix it. Anyone else?

Hi @Zaptronic,

you need a template named order (site/templates/order.php). As soon as this template exists, the payment will succeed.

I’m not sure if something changed with Kirby 4 or if no one ever ran into this problem before.

See Order template is required to complete payment · Issue #78 · wagnerwagner/merx · GitHub

1 Like

Thank you for your answer

After buying a license in 2020 (!) I finally have the opportunity to use Merx.

The starterkit is super helpful. There’s one thing I don’t understand, though:

One thing confuses me: on the order page, products are saved in a structure field with keys and IDs that both appear to be the product’s UUID. Is this a leftover from before UUIDs were used?

Is there a way to disable the multi language feature? Because i want only use the german language.

Hi @thguenther,
thank you for your continued trust in Merx. After checking the first post of this thread, I realized, that we missed to celebrate the 5th (!) birthday of Merx – how time flies.

Back to your question: Key and ID are the same in most cases. Most times, you add a product to the cart with $cart->add('new-shoes'). In this case key is set automatically to new-shoes in the background. When you later on add the same product (new-shoes) to the cart, the quantity is set to 2. This happens based on the key. In some cases, you do not want the quantity to be summed up. In these cases you can manually set the key to distinguish between product variants. There is an example in the following Product Variants Cookbook.

To summarize: ID ist the page id. Key could be any unique string.

Does that make things clearer?

1 Like

Hey @neuling,

sure, Merx also works with a single language page.

Remove languages => true from the config.php (or set it to false). To make use of german translations for error messages, you should set locale to de_DE.utf-8.

Not related to Merx, but a little bonus for better slugs: Set slugs to de

// config.php
return [
    // remove 'languages' => true,
    'locale' => 'de_DE.utf-8',
    'slugs' => 'de',
];

Thank you, @tobiasfabian. That does indeed make things clear for me.