Multi Vendor Marketplace Plugin | WCFM Marketplace › Forums › WCFM – Ultimate › Product price limit
- This topic has 8 replies, 3 voices, and was last updated 4 years, 7 months ago by eritechdeveloper.
- AuthorPosts
- December 31, 2019 at 7:18 pm #100248SoWoSParticipant
Hello,
Just a question, is it possible or is there a code to limit the minimum price of a product when adding a product by a seller? (impossible for the seller to sell a product less than 6 € for example)
Thank you - January 14, 2020 at 2:44 pm #101999SushobhanKeymaster
There isn’t a ready made setting for that. But you can add a check on JavaScript side on price field focusout event. Refer to the sample code –
$( '#regular_price' ).focusout( function () { if ( $( this ).val() < 6 ) { // alert('Please set price greater than 6'); $( this ).val(6); $(this).focus(); } } );
You need to add this code to a JS file. Alternatively you can use a plugin like https://wordpress.org/plugins/custom-css-js/
- May 4, 2020 at 8:11 pm #126566eritechdeveloperParticipant
facing a similar issue here, I just applied that JS code, using the custom-css-js plugin you recommended, but I was able to add a product priced at £3.
Thank you in advance.
- May 4, 2020 at 8:47 pm #126585SushobhanKeymaster
Hello,
You will need to wrap this inside jQuery ready method. Like the following-jQuery( document ).ready( function ( $ ) { $( '#regular_price' ).focusout( function () { if ( $( this ).val() < 6 ) { // alert('Please set price greater than 6'); $( this ).val(6); $(this).focus(); } } ); } );
Let me know how it goes.
Thank You! - May 5, 2020 at 12:11 am #126664eritechdeveloperParticipant
Hi Sushobhan,
Thanks for your reply, I applied it as follows but it is not working.
Could it be because I am setting it up for bookable products and the base cost, which I renamed with the help of your colleague to “Price”.
jQuery(document).ready(function( $ ){
$( ‘#regular_price’ ).focusout( function () {
if ( $( this ).val() < 6 ) { //
alert(‘Please set price greater than 6’);
$( this ).val(6);
$(this).focus();
}
} );
});Best regards,
Robel - May 5, 2020 at 5:35 pm #127002SushobhanKeymaster
Ohh! You didn’t tell me that earlier. Please use the following snippet-
jQuery( document ).ready( function ( $ ) { $( '#_wc_booking_cost' ).focusout( function () { if ( $( this ).val() < 6 ) { // alert('Please set price greater than 6'); $( this ).val(6); $(this).focus(); } } ); } );
Please clear cache before check.
Thank You! - May 5, 2020 at 6:20 pm #127030eritechdeveloperParticipant
My fault for not sharing that earlier.
You are a legend, it works like a dream, Thank you so much Sushobhan.
- May 5, 2020 at 6:37 pm #127036SushobhanKeymaster
Please, you’re embarrassing me ^^’
Let me know if there’s anything else we can help you with.
Can we ask for a favor? Would you mind taking a few minutes to review our plugin (if you haven’t already) at https://wordpress.org/support/plugin/wc-multivendor-marketplace/reviews/ and let others know about your 5 Star experience with WCFM Marketplace. Also, follow us on Twitter https://twitter.com/wcfmmp for more exciting news, important updates, and irresistible offers.Thank You 🙂
- May 5, 2020 at 7:47 pm #127059eritechdeveloperParticipant
Thank you, sure I will do.
I have just left my first word press you for a plugin on WCFM.
I do not have Twitter, but once I sign up you will be among the first that I follow.
- AuthorPosts
- You must be logged in to reply to this topic.