2011-08-10 17:11:11 +00:00
< ? php
/**
* Checkout Shortcode
*
* Used on the checkout page , the checkout shortcode displays the checkout process .
*
* @ package WooCommerce
* @ category Shortcode
* @ author WooThemes
*/
function get_woocommerce_checkout ( $atts ) {
2011-09-06 11:11:22 +00:00
global $woocommerce ;
return $woocommerce -> shortcode_wrapper ( 'woocommerce_checkout' , $atts );
2011-08-10 17:11:11 +00:00
}
function woocommerce_checkout ( $atts ) {
2011-09-13 16:17:52 +00:00
global $woocommerce , $woocommerce_checkout ;
2011-09-06 11:11:22 +00:00
2011-08-10 17:11:11 +00:00
if ( ! defined ( 'WOOCOMMERCE_CHECKOUT' )) define ( 'WOOCOMMERCE_CHECKOUT' , true );
2011-11-06 13:45:18 +00:00
if ( sizeof ( $woocommerce -> cart -> get_cart ()) == 0 ) :
2012-01-06 17:14:31 +00:00
wp_redirect ( get_permalink ( woocommerce_get_page_id ( 'cart' )));
2011-08-10 17:11:11 +00:00
exit ;
endif ;
$non_js_checkout = ( isset ( $_POST [ 'update_totals' ]) && $_POST [ 'update_totals' ]) ? true : false ;
2011-12-08 12:50:50 +00:00
$woocommerce_checkout = $woocommerce -> checkout ();
2011-08-10 17:11:11 +00:00
2011-09-13 16:17:52 +00:00
$woocommerce_checkout -> process_checkout ();
2011-08-10 17:11:11 +00:00
2011-11-09 17:26:45 +00:00
do_action ( 'woocommerce_check_cart_items' );
2011-08-10 17:11:11 +00:00
2012-01-05 11:31:22 +00:00
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' ) );
2011-08-10 17:11:11 +00:00
woocommerce_get_template ( 'checkout/form.php' , false );
}