Viewing 15 replies - 16 through 30 (of 44 total)
  • looking to set up a minimum amount for the check out, I found this plug in -Minimum Purchase for WooCommerce- I tested it on wp 3.4.9 and it worked perfect but now on 3.5.1 I get a grey screen and does not let set up the rules need, might want to give it a try and see it works for you guys.

    Kristicecca, you have to add it to your theme’s function.php

    any ideas on how we can get the message to be translatable using WPML. I don’t know PHP although I tried a few things but did not work.

    Any suggestions would be greatly appreciated.

    Just had to log in to say thanks for this simple piece of code… it’s awesome… well done

    Thanks bheadrick, you are right that function makes it translatable as per WPML documentation, I was just not using the string translator propertly, you guys can see it in action by trying to buy from here.

    Thanks for the script it sure save me a lot of time.

    Deifos is right, either of these two plugins will set a minimum purchase rule:

    Minimum Purchase for WooCommerce
    Min and Max Purchase for WooCommerce

    The bug Deifos experienced was resolved with v 1.06.

    However I think vark’s plug in is the way to go if you don’t want to mess with any code on the theme, I will be trying it on my next project so it will make easier for the client to adjust the max and min amounts from the admin panel. Thanks for your plugin vark

    HELLO,

    CAN SOME ONE PLS BE MORE SPECIFIC WHERE TO PLACE THE CODE?

    THERE ARE NEWBEE’S THAT DOESN’T HAVE PHP KNOWLEDGE SO PLS, BE MORE SPECIFIC FOR EXAMPLE: SPECIFY THE ROOT PAD OF THE FILE NAME AND ON WHAT LINE THE CODE SHOULD BE ADDED.

    add_action('the_post','minimum_order_func',10);
    function minimum_order_func(){
    global $woocommerce;
    if (is_checkout()){
    $minorder = 50;
    if( $woocommerce->cart->subtotal < $minorder){
     $woocommerce->add_error( sprintf(__('Sorry, you have not met the minimum order amount of $' . $minorder . '. <a href="%s">Return to homepage &rarr;</a>', 'woocommerce'), home_url()) );
        wp_redirect( get_permalink( woocommerce_get_page_id( 'cart' ) ) );
       			exit;
    }}}

    THANKS,

    THAT WILL HELP A LOT OF PEOPLE ASKING THE SAME QUESTIONS

    Theworld if you are not familiar with PHP I would suggest you to use the Minimum Purchase for WooCommerce plugin it does what you want and more and very easy to use, I received a email from the developer stating that he fixed the bug with wp 3.5, so give it a try.

    If you ever want to place hooks(add_action) and filters(add_filter), please put it at the end of your theme’s functions.php

    For example:

    add_action('the_post','minimum_order_func',10);
    function minimum_order_func(){
    global $woocommerce;
    if (is_checkout()){
    $minorder = 50;
    if( $woocommerce->cart->subtotal < $minorder){
      $woocommerce->add_error( sprintf(__('Sorry, you have not met the minimum order amount of $' . $minorder . '. <a href="%s">Return to homepage →</a>', 'woocommerce'), home_url()) );
      wp_redirect( get_permalink( woocommerce_get_page_id( 'cart' ) ) );
      exit;
    }}}

    i got woocommerce checkout redirect if minimum order amt less than 100 working.

    Thanks for all. and this is the right place for the solution.

    hi hi,

    … Is it possible to bring this function / hook(add_action) in conjunction with the shipping method “local delivery”?

    So that it applies only to this shipping method “local delivery”.

    ———————————————-
    … Ist es m?glich, diese Funktion in Verbindung mit der Versandmethode “Lokale Zustellung” zu bringen?
    So das sie nur für diese Versandmethode gilt.

    Many thanks for your help!

    g, mike

    … there is a another problem ??

    If I put it (this hook) at the end of my theme’s functions.php,
    then I’ve following error:

    Fatal error: Cannot unset string offsets in /../../wp-content/plugins/woocommerce/classes/abstracts/abstract-wc-session.php on line 66

    Have someone any help for me?

    Thanks, mike

    Fatal error: Cannot unset string offsets in /../../wp-content/plugins/woocommerce/classes/abstracts/abstract-wc-session.php on line 66

    Hi mike73, have you updated to latest WooCommerce version? I found a bug issue at github = https://github.com/woothemes/woocommerce/issues/3135

    and they solved that by updated the core file:
    https://github.com/woothemes/woocommerce/commit/2db3d24a8297c2b25b13fd700fc5a903d6763a40

    Hope that will help.

    Hi Terry,

    … yes I’ve the latest version wooCommerce.
    WooCommerce Version: 2.0.13
    WooCommerce Datenbank-Version: 2.0.13

    Do you mean, the bugfix ist not in the latest version (2.0.13)?
    And I must take the bugfix from/in the 3 files?

    But in the latest version (2.0.13) is the code completely different,
    than the core files by this (this is wooCommerceVersion 2.0.0!):
    https://github.com/woothemes/woocommerce/commit/2db3d24a8297c2b25b13fd700fc5a903d6763a40

    For example in the version (2.0.13):

    public function __unset( $property ) {
        	if ( isset( $this->_data[ $property ] ) ) {
           		unset( $this->_data[ $property ] );
           		$this->_dirty = true;
            }
        }

    … instead in the version (2.0.0) by the updated core file:

    public function __unset( $key ) {
         if ( isset( $this->_data[ $key ] ) ) {
                unset( $this->_data[ $key ] );
            $this->_dirty = true;
            }
        }

    the version (2.0.13) use “$property” instead “$key”!

    What should I do?

    g, mike

Viewing 15 replies - 16 through 30 (of 44 total)
  • The topic ‘Set a minimum order for cart total?’ is closed to new replies.