Formal and informal German translations - thanks to stefahn, jessor, Ramoonus , owcv and deckerweb
* Hook for checking cart contents during cart/checkout - used for plugins too
This commit is contained in:
parent
1b9b1ea2cc
commit
67779afd3f
|
@ -45,6 +45,8 @@ class woocommerce_cart {
|
||||||
$this->applied_coupons = array();
|
$this->applied_coupons = array();
|
||||||
$this->get_cart_from_session();
|
$this->get_cart_from_session();
|
||||||
if ( isset($_SESSION['coupons']) ) $this->applied_coupons = $_SESSION['coupons'];
|
if ( isset($_SESSION['coupons']) ) $this->applied_coupons = $_SESSION['coupons'];
|
||||||
|
|
||||||
|
add_action('woocommerce_check_cart_items', array(&$this, 'check_cart_items'), 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -540,6 +542,17 @@ class woocommerce_cart {
|
||||||
if ( $this->total > 0 ) return true; else return false;
|
if ( $this->total > 0 ) return true; else return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Check cart items for errors
|
||||||
|
*/
|
||||||
|
function check_cart_items() {
|
||||||
|
|
||||||
|
$result = $this->check_cart_item_stock();
|
||||||
|
if (is_wp_error($result)) $woocommerce->add_error( $result->get_error_message() );
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* looks through the cart to check each item is in stock
|
* looks through the cart to check each item is in stock
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -677,24 +677,8 @@ class woocommerce_checkout {
|
||||||
'item_meta' => $item_meta->meta
|
'item_meta' => $item_meta->meta
|
||||||
), $values);
|
), $values);
|
||||||
|
|
||||||
// Check stock levels
|
// Check cart items for errors
|
||||||
if ($_product->managing_stock()) :
|
do_action('woocommerce_check_cart_items');
|
||||||
if (!$_product->is_in_stock() || !$_product->has_enough_stock( $values['quantity'] )) :
|
|
||||||
|
|
||||||
$woocommerce->add_error( sprintf(__('Sorry, we do not have enough "%s" in stock to fulfil your order. Please edit your cart and try again. We apologise for any inconvenience caused.', 'woothemes'), $_product->get_title() ) );
|
|
||||||
break;
|
|
||||||
|
|
||||||
endif;
|
|
||||||
else :
|
|
||||||
|
|
||||||
if (!$_product->is_in_stock()) :
|
|
||||||
|
|
||||||
$woocommerce->add_error( sprintf(__('Sorry, we do not have enough "%s" in stock to fulfil your order. Please edit your cart and try again. We apologise for any inconvenience caused.', 'woothemes'), $_product->get_title() ) );
|
|
||||||
break;
|
|
||||||
|
|
||||||
endif;
|
|
||||||
|
|
||||||
endif;
|
|
||||||
|
|
||||||
endforeach;
|
endforeach;
|
||||||
|
|
||||||
|
|
|
@ -107,6 +107,7 @@ Yes you can! Join in on our GitHub repository :) https://github.com/woothemes/wo
|
||||||
* Directory changed for uploading file downloads - uploads/woocommerce_files
|
* Directory changed for uploading file downloads - uploads/woocommerce_files
|
||||||
* Download directory created on install as well as htaccess for denying access
|
* Download directory created on install as well as htaccess for denying access
|
||||||
* Formal and informal German translations - thanks to stefahn, jessor, Ramoonus , owcv and deckerweb
|
* Formal and informal German translations - thanks to stefahn, jessor, Ramoonus , owcv and deckerweb
|
||||||
|
* Hook for checking cart contents during cart/checkout - used for plugins too
|
||||||
|
|
||||||
= 1.2 - 03/11/2011 =
|
= 1.2 - 03/11/2011 =
|
||||||
* Added quick status change buttons (processing/complete) to orders panel
|
* Added quick status change buttons (processing/complete) to orders panel
|
||||||
|
|
|
@ -62,10 +62,7 @@ function woocommerce_cart( $atts ) {
|
||||||
|
|
||||||
endif;
|
endif;
|
||||||
|
|
||||||
$result = $woocommerce->cart->check_cart_item_stock();
|
do_action('woocommerce_check_cart_items');
|
||||||
if (is_wp_error($result)) :
|
|
||||||
$woocommerce->add_error( $result->get_error_message() );
|
|
||||||
endif;
|
|
||||||
|
|
||||||
$woocommerce->show_messages();
|
$woocommerce->show_messages();
|
||||||
|
|
||||||
|
|
|
@ -30,9 +30,7 @@ function woocommerce_checkout( $atts ) {
|
||||||
|
|
||||||
$woocommerce_checkout->process_checkout();
|
$woocommerce_checkout->process_checkout();
|
||||||
|
|
||||||
$result = $woocommerce->cart->check_cart_item_stock();
|
do_action('woocommerce_check_cart_items');
|
||||||
|
|
||||||
if (is_wp_error($result)) $woocommerce->add_error( $result->get_error_message() );
|
|
||||||
|
|
||||||
if ( $woocommerce->error_count()==0 && $non_js_checkout) $woocommerce->add_message( __('The order totals have been updated. Please confirm your order by pressing the Place Order button at the bottom of the page.', 'woothemes') );
|
if ( $woocommerce->error_count()==0 && $non_js_checkout) $woocommerce->add_message( __('The order totals have been updated. Please confirm your order by pressing the Place Order button at the bottom of the page.', 'woothemes') );
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue