woocommerce/shortcodes/shortcode-thankyou.php

42 lines
1006 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 ) {
2012-02-03 16:17:35 +00:00
global $woocommerce;
2012-01-10 16:43:06 +00:00
2012-02-24 21:05:15 +00:00
$woocommerce->nocache();
2012-02-07 12:09:23 +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) :
2012-01-27 16:38:39 +00:00
$order = new WC_Order( $order_id );
if ($order->order_key != $order_key) :
unset($order);
2011-08-10 17:11:11 +00:00
endif;
endif;
2012-02-03 16:17:35 +00:00
woocommerce_get_template( 'checkout/thankyou.php', array( 'order' => $order ) );
2011-08-10 17:11:11 +00:00
}