The Commerce GUI doesn't let you set a whole cart discount but you can do it as an adjuster in a module/plugin.
Setup the scaffolding for a module at pluginfactory then add a folder inside called adjusters and name it OrderAdjuster.php
Throw this code in (modified from a another project):
Not a direct answer, but for anyone looking to do this, this can be implemented natively with Craft / Commerce, and with really pretty simple logic, all without a plugin.
For example, you can have a section with the email content for each of your products, plus a commerce products relation field, to choose the product this particular content relates to.
Found the answer:
in both discounts "Don’t apply any subsequent discounts to an order if this discount is applied" has to be active.
and the discount with the higher value (in my case > 200$ -> 10%) has to be above the other discount in the control panel.
and to check on the page itself, use the "update cart" button and not the ...
This is working for me, there might be a better solution:
i get the id from the manual payment gateway (thanks jeremy),
set it and if its this manual gateway i make the order without payment.
otherwise go ahead with the normal process.
i put this all in the payment.twig
You want to look at Commerce's 'manual' gateway.
This is a gateway that let's you receive unpaid orders, which you can then process as you see fit, including manually 'capturing' the payment when it is ultimately made.
We use this to e.g. offer a mechanism for people to pay by direct bank deposit - we just leave the orders in a 'holding' status until the ...
The getPaymentFormHtml() method will output a huge chunk of code, including Stripe's iframe and all its nested fields and functionality - you can't simply wrap that in a label element and expect it to work, as the click event of the label will not reach inside the iFrame.
The default output of Commerce Stripe's getPaymentFormHtml leaves a lot to be desired, ...