Support » Plugin: Woocommerce Minimum and Maximum Quantity » Add line of text such as “MOQ: X units” beside add to cart button

  • Hey,

    Any way you can add the possibility of adding a small piece of text (if possible defined by the admin) on the side of the add to cart button, so we can add messages such as:

    Min order qty 10
    Max order qty 100
    Min order qty 10 and max order qty 100

    and possible the best o the best would be to be able to define a message such as

    Min order qty 10 and max order qty 100 for bigger orders please contact us

    Thanks

Viewing 5 replies - 1 through 5 (of 5 total)
  • Plugin Author Ashok G

    (@wpashokg)

    @andresmolina,

    Sorry for the delayed reply. Guess you can do custom messaging using the functions.php using custom hooks

    mmmmm you are talking klingon to me.. im afraid Im a mid average user.. i can read code, i can do slight changes in it.. but im terrible on creating code.. i was wondering if it is something you are planning to include in your plugin, as it is such a great plugin that the only thing i can see its missing is this small detail.

    @andresmolina have you managed to create this hooks?
    Let me know. I’m interested in the same thing.
    Thanks.

    I found a way of doing this. Add the following code in your theme functions.php file.

    add_action('woocommerce_after_add_to_cart_button', 'wc_min_quantity',10,2);
    function wc_min_quantity($product)
    {
    if(function_exists('icl_object_id')) {
    	$default_language = wpml_get_default_language();
    	$prodid = icl_object_id($product->get_id(), 'product', true, $default_language);
      } else {
          $prodid = $product->id;
      }
      $prodid = get_the_ID();
      $minQty     = get_post_meta($prodid, '_wc_mmax_min', true);
      if ($minQty > 0) {
      }
    
      echo "Minimum quantity per order: $minQty";
       
    }
    Plugin Author Ashok G

    (@wpashokg)

    Kudos @bugsjr

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Add line of text such as “MOQ: X units” beside add to cart button’ is closed to new replies.