Add minimumAmount as options parameter
Description
Add the minimumAmount parameter to the possible options.
Now the possible options are:
{% set options = {
amount: 99.99,
quantity: 2,
calculateFinalAmount: false,
itemName : 'Test Name',
itemDescription : 'Test Description',
checkoutImages: {0:"https://yourdomain.com/assets/docs/nice-image-product.png"},
checkoutSuccessUrl: '/thank-you?number={number}',
checkoutCancelUrl: '/uh-oh'
} %}
I want to have a customAmount field, with the minimum value dynamic (from an entry for example), so I changed the "amount" value with the option parameter "amount", but the customAmount field doesn't change because it uses the minimumAmount value instead of the option "amount". And the minimumAmount is not changeable from the rendering tag.
So when there would be a parameter option "minimumAmount", then the custom amount uses that value as a minimum. This would give the user more options to dynamic prices.
{% set options = {
amount: 99.99,
minimumAmount: 99.99,
} %}
Or change the paymentForm template from:
{% set minimumAmount = paymentForm.amount ? "%.2f"|format(paymentForm.amount) : paymentForm.minimumAmount ? "%.2f"|format(paymentForm.minimumAmount) : '' %}
to:
{% set minimumAmount = options.amount ? "%.2f"|format(options.amount) : paymentForm.minimumAmount ? "%.2f"|format(paymentForm.minimumAmount) : '' %}
when there is a options.amount ;)
Thanks in advance
Hi @tomfischerNL have you considered using the template overrides feature? Documentation here:
- https://docs.enupal.com/stripe-payments/plugin-development/template-overrides.html
Yes I did, I changed it in a custom template, but it should be an option in the regular one ;)
{% set minimumAmount = options.amount is defined and options.amount is not empty ? "%.2f"|format(options.amount) : paymentForm.minimumAmount ? "%.2f"|format(paymentForm.minimumAmount) : '' %}