Checkout error page
This commit is contained in:
parent
1c6b6ac1dd
commit
9cf264504b
|
@ -21,6 +21,7 @@ class WC_Checkout {
|
||||||
function __construct () {
|
function __construct () {
|
||||||
global $woocommerce;
|
global $woocommerce;
|
||||||
|
|
||||||
|
add_action('woocommerce_checkout_process',array(&$this,'checkout_process'));
|
||||||
add_action('woocommerce_checkout_billing',array(&$this,'checkout_form_billing'));
|
add_action('woocommerce_checkout_billing',array(&$this,'checkout_form_billing'));
|
||||||
add_action('woocommerce_checkout_shipping',array(&$this,'checkout_form_shipping'));
|
add_action('woocommerce_checkout_shipping',array(&$this,'checkout_form_shipping'));
|
||||||
|
|
||||||
|
@ -59,6 +60,12 @@ class WC_Checkout {
|
||||||
);
|
);
|
||||||
$this->checkout_fields = apply_filters('woocommerce_checkout_fields', $this->checkout_fields);
|
$this->checkout_fields = apply_filters('woocommerce_checkout_fields', $this->checkout_fields);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** Checkout process */
|
||||||
|
function checkout_process() {
|
||||||
|
// When we process the checkout, lets ensure cart items are rechecked to prevent checkout
|
||||||
|
do_action('woocommerce_check_cart_items');
|
||||||
|
}
|
||||||
|
|
||||||
/** Output the billing information form */
|
/** Output the billing information form */
|
||||||
function checkout_form_billing() {
|
function checkout_form_billing() {
|
||||||
|
|
|
@ -87,6 +87,8 @@ Yes you can! Join in on our GitHub repository :) https://github.com/woothemes/wo
|
||||||
* Classes added to my-account
|
* Classes added to my-account
|
||||||
* Fix for price filtering when the shop is the homepage
|
* Fix for price filtering when the shop is the homepage
|
||||||
* Renamed orderby GET variable to 'sort' to prevent conflicts with permalinks
|
* Renamed orderby GET variable to 'sort' to prevent conflicts with permalinks
|
||||||
|
* Fixed a bug allowing checkout when items are out of stock
|
||||||
|
* Added a cart item error page for checkout, if the items are invalid
|
||||||
|
|
||||||
= 1.4.2 - 09/02/2012 =
|
= 1.4.2 - 09/02/2012 =
|
||||||
* Uninstall fix
|
* Uninstall fix
|
||||||
|
|
|
@ -21,11 +21,20 @@ function woocommerce_checkout( $atts ) {
|
||||||
|
|
||||||
if (sizeof($woocommerce->cart->get_cart())==0) return;
|
if (sizeof($woocommerce->cart->get_cart())==0) return;
|
||||||
|
|
||||||
$non_js_checkout = (isset($_POST['woocommerce_checkout_update_totals']) && $_POST['woocommerce_checkout_update_totals']) ? true : false;
|
|
||||||
|
|
||||||
do_action('woocommerce_check_cart_items');
|
do_action('woocommerce_check_cart_items');
|
||||||
|
|
||||||
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.', 'woocommerce') );
|
if ( $woocommerce->error_count()>0 ) {
|
||||||
|
|
||||||
|
woocommerce_get_template('checkout/cart-errors.php');
|
||||||
|
|
||||||
|
} else {
|
||||||
|
|
||||||
|
$non_js_checkout = (isset($_POST['woocommerce_checkout_update_totals']) && $_POST['woocommerce_checkout_update_totals']) ? true : false;
|
||||||
|
|
||||||
|
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.', 'woocommerce') );
|
||||||
|
|
||||||
|
woocommerce_get_template('checkout/form-checkout.php');
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
woocommerce_get_template('checkout/form-checkout.php');
|
|
||||||
}
|
}
|
|
@ -0,0 +1,13 @@
|
||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* Cart errors page
|
||||||
|
*/
|
||||||
|
?>
|
||||||
|
|
||||||
|
<?php $woocommerce->show_messages(); ?>
|
||||||
|
|
||||||
|
<p><?php _e('There are some issues with the items in your cart (shown above). Please go back to the cart page and resolve these issues before checking out.', 'woocommerce') ?></p>
|
||||||
|
|
||||||
|
<?php do_action('woocommerce_cart_has_errors'); ?>
|
||||||
|
|
||||||
|
<p><a class="button" href="<?php echo get_permalink(woocommerce_get_page_id('cart')); ?>"><?php _e('← Return To Cart', 'woocommerce') ?></a></p>
|
Loading…
Reference in New Issue