Tips and Tricks HQ Support Portal › Forums › WP eStore Forum › Custom Price Feature – Please specify a minimum amount of XX
Tagged: custom price, product variations
- This topic has 5 replies, 2 voices, and was last updated 10 years, 7 months ago by admin.
-
AuthorPosts
-
April 2, 2014 at 7:01 pm #10595sorroMember
Hi. I am looking to setup a product with 6 donation variations AND an option for people to specify their own donation amount (using “Allow Customers to Specify a Price”). However, if the custom price is empty, a Javascript error pops up saying: “Please specify a minimum amount of $0.00”
Basically, I think the plugin should ignore the custom price when a variation is chosen.
I have looked in a few places here and even tried to identify the code line that would need to be changed, but couldn’t find a working solution:
Please help.
Thanks.
April 3, 2014 at 6:54 am #62045adminKeymasterUsing variation with custom price option is fine. Your customers can still specify a custom amount and choose a variation. They just can’t leave that custom amount field empty.
Have you tried entering an amount in the custom price field then selecting a variation and see what happens?
April 3, 2014 at 11:08 am #62046sorroMemberThanks for your reply. Yes, I have tried that and when they enter an amount in the custom price is works.
However, entering something it an annoying restriction for my customers. If they choose a variation (which already has a price associated), they should NOT have to enter anything as custom price! In other words, I want them to either be able to choose a variation (without a custom price) OR enter a custom price and then the variation should be ignored.
It is basically for making a donation, where customers can choose between fixed donation amounts OR specify their own amount.
How can this be achieved?
Btw, if this involves PHP coding, that’s fine. I’d just need to know where exactly to edit. For my project, I am perfectly happy with turning off the error message (minimum amount) completely. Where would I go to turn it off?
Thanks.
April 3, 2014 at 1:09 pm #62047adminKeymasterokay. That check comes from a JavaScript file. Do the following:
1) Open the “lib/eStore_read_form.js” file.
2) Search for the following function in that file:
function eStore_custom_price_validated(object1,custom_price)
3) Always return true from that function.
That will do the job.
April 3, 2014 at 2:47 pm #62048sorroMemberThanks a lot, that is a huge help.
Now that I know where this is coming from, I have a slightly different idea re. changing the eStore_custom_price_validated function. Would it be possible to rewrite line 145 of “lib/eStore_read_form.js” to integrate/take into account price variations with custom price?
Something like:
if(isset(price_variation)) {
if (price_variation < min_amt) {
alert(JS_WP_ESTORE_MINIMUM_PRICE_YOU_CAN_ENTER + min_amt);
return false;
}
else {
return true;
}
elseif (isNaN(custom_price) || custom_price < min_amt) {
alert(JS_WP_ESTORE_MINIMUM_PRICE_YOU_CAN_ENTER + min_amt);
return false;
}
else {
return true;
}
}
Does object1 passed to this function contain any information about the *price_variation* selected? (Something like object1.selected_price_variation)
Thanks a lot again for all your help.
April 4, 2014 at 5:42 am #62049adminKeymasterYour idea is very good but it won’t be possible to do because the variation price is actually not available there. The issue mainly comes from trying to use the custom price feature for a different purpose than intended. When you enable the custom price feature, the plugin assumes the following:
The customer always have to specify an amount (for that product or for a variation of that product).
I am going to suggest an alternative way to what you are after.
Create two eStore products with the following:
1) Has fixed variations for users to choose/select
2) Just has the custom price option
Now, on your donations page, you can place two buttons for these two products. Your customers will choose one or the other.
-
AuthorPosts
- You must be logged in to reply to this topic.