Product price limit

We're shifting our Forum based support to a more dedicated support system!

We'll be closing our Forum support from 10th June, 2020 and move to Email Support assistance.

  • If you are a WCFM premium add-ons user, contact us- here
  • Want to know more before buying our add-ons? Send Pre sale queries- here
  • If you are a WCFM free user, please open a support ticket at WordPress.org
  • For WCFM App related queries, reach us- here
From now the forum will be read-only!

Viewing 8 reply threads
  • Author
    Posts
    • #100248
      SoWoS
      Participant

      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

    • #101999
      Sushobhan
      Keymaster

      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/

    • #126566
      eritechdeveloper
      Participant

      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.

    • #126585
      Sushobhan
      Keymaster

      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!

    • #126664
      eritechdeveloper
      Participant

      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

    • #127002
      Sushobhan
      Keymaster

      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!

    • #127030
      eritechdeveloper
      Participant

      My fault for not sharing that earlier.

      You are a legend, it works like a dream, Thank you so much Sushobhan.

    • #127036
      Sushobhan
      Keymaster

      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 🙂

    • #127059
      eritechdeveloper
      Participant

      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.

Viewing 8 reply threads
  • You must be logged in to reply to this topic.