woocommerce/shortcodes/shortcode-thankyou.php

40 lines
968 B
PHP
Raw Normal View History

2011-08-10 17:11:11 +00:00
<?php
/**
* Thankyou Shortcode
*
* The thankyou page displays after successful checkout and can be hooked into by payment gateways.
*
* @package WooCommerce
* @category Shortcode
* @author WooThemes
*/
function get_woocommerce_thankyou( $atts ) {
global $woocommerce;
return $woocommerce->shortcode_wrapper('woocommerce_thankyou', $atts);
2011-08-10 17:11:11 +00:00
}
/**
* Outputs the order received page
2011-08-10 17:11:11 +00:00
**/
function woocommerce_thankyou( $atts ) {
global $woocommerce, $order;
2012-01-10 16:43:06 +00:00
2012-01-12 00:54:45 +00:00
$order = false;
2011-08-10 17:11:11 +00:00
// Pay for order after checkout step
if (isset($_GET['order'])) $order_id = $_GET['order']; else $order_id = 0;
if (isset($_GET['key'])) $order_key = $_GET['key']; else $order_key = '';
2011-08-11 22:39:02 +00:00
// Empty awaiting payment session
unset($_SESSION['order_awaiting_payment']);
2011-08-10 17:11:11 +00:00
if ($order_id > 0) :
2011-12-10 18:40:51 +00:00
$order = new woocommerce_order( $order_id );
if ($order->order_key != $order_key) :
unset($order);
2011-08-10 17:11:11 +00:00
endif;
endif;
woocommerce_get_template( 'checkout/thankyou.php' );
2011-08-10 17:11:11 +00:00
}