woocommerce/shortcodes/shortcode-thankyou.php

57 lines
1.2 KiB
PHP
Raw Normal View History

2011-08-10 17:11:11 +00:00
<?php
/**
* Thankyou Shortcode
2012-08-14 17:37:50 +00:00
*
2011-08-10 17:11:11 +00:00
* The thankyou page displays after successful checkout and can be hooked into by payment gateways.
*
2012-08-14 17:37:50 +00:00
* @author WooThemes
* @category Shortcodes
* @package WooCommerce/Shortcodes/Thankyou
* @version 1.6.4
*/
/**
* Get the thankyou shortcode content.
*
* @access public
* @param array $atts
* @return string
2011-08-10 17:11:11 +00:00
*/
function get_woocommerce_thankyou( $atts ) {
global $woocommerce;
2012-08-14 17:37:50 +00:00
return $woocommerce->shortcode_wrapper('woocommerce_thankyou', $atts);
2011-08-10 17:11:11 +00:00
}
2012-08-14 17:37:50 +00:00
2011-08-10 17:11:11 +00:00
/**
2012-08-14 17:37:50 +00:00
* Outputs the thankyou page
*
* @access public
* @param mixed $atts
* @return void
*/
function woocommerce_thankyou( $atts ) {
2012-02-03 16:17:35 +00:00
global $woocommerce;
2012-08-14 17:37:50 +00:00
2012-02-24 21:05:15 +00:00
$woocommerce->nocache();
2012-08-14 17:37:50 +00:00
2012-03-09 16:12:36 +00:00
$woocommerce->show_messages();
2012-02-07 12:09:23 +00:00
2012-01-12 00:54:45 +00:00
$order = false;
2012-08-14 17:37:50 +00:00
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 = '';
2012-08-14 17:37:50 +00:00
2011-08-11 22:39:02 +00:00
// Empty awaiting payment session
2012-09-07 17:26:13 +00:00
unset( $woocommerce->session->order_awaiting_payment );
2012-08-14 17:37:50 +00:00
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
}