Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add minimumAmount as options parameter #331

Open
tomfischerNL opened this issue Jan 3, 2023 · 2 comments
Open

Add minimumAmount as options parameter #331

tomfischerNL opened this issue Jan 3, 2023 · 2 comments
Assignees
Labels
question Further information is requested

Comments

@tomfischerNL
Copy link

tomfischerNL commented Jan 3, 2023

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

@andrelopez
Copy link
Member

Hi @tomfischerNL have you considered using the template overrides feature? Documentation here:

@andrelopez andrelopez self-assigned this Jan 12, 2023
@andrelopez andrelopez added the question Further information is requested label Jan 12, 2023
@tomfischerNL
Copy link
Author

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) : '' %}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

2 participants