Tips and Tricks HQ Support Portal › Forums › WP eStore Forum › WP eStore Tweaks › eStore – $0 base price with variations, customizing plus (+) this ammount
Tagged: estore variations, minimum periods, variations
- This topic has 9 replies, 4 voices, and was last updated 9 years, 7 months ago by Ricardo.
-
AuthorPosts
-
August 30, 2013 at 12:00 pm #9587aceSpectator
Hello,
I am selling digital products (photos) and want to use variations for different photo resolutions.
There is (+) for 2nd variation.
If I set base price 0 (0 dollars) and price for every variation, it loads $0 on page load instead of price of the first variation.
1. Can it cause any problem with database, payment or anything else if the base price is 0 and all variations has prices including first one?
example:
License|Single::5::http://yourdomain.com/downloads/somefile.zip|Business::10::http://yourdomain.com/downloads/somefile2.zip
2. How to load price of the first variation on web page load instead of $0 base price?
Thanks
August 30, 2013 at 11:31 pm #57481adminKeymasterIt won’t cause any issue with database, payment or anything else. It is perfectly okay to have the base price as 0 and then the variations have the full price.
You can have your first variation drop down to say “Selece One” which will make sense. As soon as the user selects a variation, the price field will update accordingly.
Here is an example of how to make the first variation drop down to say “Select one”:
License|Select One|
Single::5::http://example.com/downloads/somefile.zip|
Business::10::http://example.com/downloads/somefile2.zip
When your customer selects a variation, the price field will update and reflect the full price for the selected variation(s).
April 6, 2015 at 2:58 pm #57482RicardoMemberI’m facing this same issue.
This workaround has a problem: the costumer can click on ‘Add to Cart’ when the variation ‘Select One’ is displayed, which would load in the Cart a wrong product of $0.
Would’t it be possible that the price of the first variation is loaded directly?
April 7, 2015 at 12:19 am #57483adminKeymasterThe easier solution would be to have a small JavaScript check. So it prevents the user from hitting add to cart when the “select one” option is selected. Are you familiar with a bit of JavaScript coding?
April 7, 2015 at 5:01 pm #57484RicardoMemberNot much. Only a few basic notions, but if you can give me some hint I’ll try to make it work
By the way, after just a few days playing around with the plugin I really like it. Many options, nice documentation on the site and a lot of info in the forum.
April 8, 2015 at 4:28 am #57485adminKeymasterHere is an example JS code. I am writing this off the top of my head so all the syntax may not be correct but it will give you an idea of what I am saying:
<script type="text/javascript">
jQuery(document).ready(function($) {
$('.eStore-button-form').on('submit', function() {
var selection_val = $(".eStore_variation :selected").text();
if (selection_val == "Select One"){
alert ("Please select a variation from the dropdown box");
return false;
}
});
});
</script>April 8, 2015 at 6:02 pm #57486RicardoMemberThanks! It almost work, but not yet. It stores in
selection_val
the values of all the variations in the shop (I have two variations per product), not only the one I´m interested in. In this case the first one.
April 8, 2015 at 8:44 pm #57487RicardoMemberUsing the selector
[name='variation1'] :selected
I get only the variation I need, but I don’t know that it only takes the value from this form and not all of them.April 9, 2015 at 12:46 am #57488wpCommerceModeratorHi, have you tried this?
var selection_val = $(this).find(".eStore_variation :selected").text();
April 9, 2015 at 5:21 am #57489RicardoMemberI knew I had to use
this
but I didn’t know how.Using
var selection_val = $(this).find("[name='variation1'] :selected").text();
works nicely
Thanks!
-
AuthorPosts
- You must be logged in to reply to this topic.