PageRenderTime 48ms CodeModel.GetById 20ms RepoModel.GetById 1ms app.codeStats 0ms

/shortcodes/shortcode-init.php

https://github.com/CammoKing/woocommerce
PHP | 875 lines | 520 code | 234 blank | 121 comment | 50 complexity | 819bbf19c6ecc4d3c45792422f2a69b7 MD5 | raw file
Possible License(s): GPL-3.0
  1. <?php
  2. /**
  3. * Shortcodes init
  4. *
  5. * Init main shortcodes, and add a few others such as recent products.
  6. *
  7. * @author WooThemes
  8. * @category Shortcodes
  9. * @package WooCommerce/Shortcodes
  10. * @version 1.7.0
  11. */
  12. if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
  13. /** Cart shortcode */
  14. include_once('shortcode-cart.php');
  15. /** Checkout shortcode */
  16. include_once('shortcode-checkout.php');
  17. /** My Account shortcode */
  18. include_once('shortcode-my_account.php');
  19. /** Order tracking shortcode */
  20. include_once('shortcode-order_tracking.php');
  21. /** Lost password shortcode */
  22. include_once( 'shortcode-lost_password.php' );
  23. /** Pay shortcode */
  24. include_once('shortcode-pay.php');
  25. /** Thanks shortcode */
  26. include_once('shortcode-thankyou.php');
  27. /**
  28. * List products in a category shortcode
  29. *
  30. * @access public
  31. * @param array $atts
  32. * @return string
  33. */
  34. function woocommerce_product_category( $atts ){
  35. global $woocommerce, $woocommerce_loop;
  36. if ( empty( $atts ) ) return;
  37. extract( shortcode_atts( array(
  38. 'per_page' => '12',
  39. 'columns' => '4',
  40. 'orderby' => 'title',
  41. 'order' => 'asc',
  42. 'category' => ''
  43. ), $atts ) );
  44. if ( ! $category ) return;
  45. $ordering_args = $woocommerce->query->get_catalog_ordering_args( $orderby, $order );
  46. $args = array(
  47. 'post_type' => 'product',
  48. 'post_status' => 'publish',
  49. 'ignore_sticky_posts' => 1,
  50. 'orderby' => $ordering_args['orderby'],
  51. 'order' => $ordering_args['order'],
  52. 'posts_per_page' => $per_page,
  53. 'meta_query' => array(
  54. array(
  55. 'key' => '_visibility',
  56. 'value' => array('catalog', 'visible'),
  57. 'compare' => 'IN'
  58. )
  59. ),
  60. 'tax_query' => array(
  61. array(
  62. 'taxonomy' => 'product_cat',
  63. 'terms' => array( esc_attr($category) ),
  64. 'field' => 'slug',
  65. 'operator' => 'IN'
  66. )
  67. )
  68. );
  69. if ( isset( $ordering_args['meta_key'] ) ) {
  70. $args['meta_key'] = $ordering_args['meta_key'];
  71. }
  72. ob_start();
  73. $products = new WP_Query( $args );
  74. $woocommerce_loop['columns'] = $columns;
  75. if ( $products->have_posts() ) : ?>
  76. <?php woocommerce_product_loop_start(); ?>
  77. <?php while ( $products->have_posts() ) : $products->the_post(); ?>
  78. <?php woocommerce_get_template_part( 'content', 'product' ); ?>
  79. <?php endwhile; // end of the loop. ?>
  80. <?php woocommerce_product_loop_end(); ?>
  81. <?php endif;
  82. wp_reset_postdata();
  83. return ob_get_clean();
  84. }
  85. /**
  86. * List all (or limited) product categories
  87. *
  88. * @access public
  89. * @param array $atts
  90. * @return string
  91. */
  92. function woocommerce_product_categories( $atts ) {
  93. global $woocommerce_loop;
  94. extract( shortcode_atts( array (
  95. 'number' => null,
  96. 'orderby' => 'name',
  97. 'order' => 'ASC',
  98. 'columns' => '4',
  99. 'hide_empty' => 1
  100. ), $atts ) );
  101. if ( isset( $atts[ 'ids' ] ) ) {
  102. $ids = explode( ',', $atts[ 'ids' ] );
  103. $ids = array_map( 'trim', $ids );
  104. } else {
  105. $ids = array();
  106. }
  107. $hide_empty = ( $hide_empty == true || $hide_empty == 1 ) ? 1 : 0;
  108. $args = array(
  109. 'number' => $number,
  110. 'orderby' => $orderby,
  111. 'order' => $order,
  112. 'hide_empty' => $hide_empty,
  113. 'include' => $ids
  114. );
  115. $product_categories = get_terms( 'product_cat', $args );
  116. $woocommerce_loop['columns'] = $columns;
  117. ob_start();
  118. // Reset loop/columns globals when starting a new loop
  119. $woocommerce_loop['loop'] = $woocommerce_loop['column'] = '';
  120. if ( $product_categories ) {
  121. woocommerce_product_loop_start();
  122. foreach ( $product_categories as $category ) {
  123. woocommerce_get_template( 'content-product_cat.php', array(
  124. 'category' => $category
  125. ) );
  126. }
  127. woocommerce_product_loop_end();
  128. }
  129. woocommerce_reset_loop();
  130. return ob_get_clean();
  131. }
  132. /**
  133. * Recent Products shortcode
  134. *
  135. * @access public
  136. * @param array $atts
  137. * @return string
  138. */
  139. function woocommerce_recent_products( $atts ) {
  140. global $woocommerce_loop;
  141. extract(shortcode_atts(array(
  142. 'per_page' => '12',
  143. 'columns' => '4',
  144. 'orderby' => 'date',
  145. 'order' => 'desc'
  146. ), $atts));
  147. $args = array(
  148. 'post_type' => 'product',
  149. 'post_status' => 'publish',
  150. 'ignore_sticky_posts' => 1,
  151. 'posts_per_page' => $per_page,
  152. 'orderby' => $orderby,
  153. 'order' => $order,
  154. 'meta_query' => array(
  155. array(
  156. 'key' => '_visibility',
  157. 'value' => array('catalog', 'visible'),
  158. 'compare' => 'IN'
  159. )
  160. )
  161. );
  162. ob_start();
  163. $products = new WP_Query( $args );
  164. $woocommerce_loop['columns'] = $columns;
  165. if ( $products->have_posts() ) : ?>
  166. <?php woocommerce_product_loop_start(); ?>
  167. <?php while ( $products->have_posts() ) : $products->the_post(); ?>
  168. <?php woocommerce_get_template_part( 'content', 'product' ); ?>
  169. <?php endwhile; // end of the loop. ?>
  170. <?php woocommerce_product_loop_end(); ?>
  171. <?php endif;
  172. wp_reset_postdata();
  173. return ob_get_clean();
  174. }
  175. /**
  176. * List multiple products shortcode
  177. *
  178. * @access public
  179. * @param array $atts
  180. * @return string
  181. */
  182. function woocommerce_products( $atts ) {
  183. global $woocommerce_loop;
  184. if (empty($atts)) return;
  185. extract(shortcode_atts(array(
  186. 'columns' => '4',
  187. 'orderby' => 'title',
  188. 'order' => 'asc'
  189. ), $atts));
  190. $args = array(
  191. 'post_type' => 'product',
  192. 'post_status' => 'publish',
  193. 'ignore_sticky_posts' => 1,
  194. 'orderby' => $orderby,
  195. 'order' => $order,
  196. 'posts_per_page' => -1,
  197. 'meta_query' => array(
  198. array(
  199. 'key' => '_visibility',
  200. 'value' => array('catalog', 'visible'),
  201. 'compare' => 'IN'
  202. )
  203. )
  204. );
  205. if(isset($atts['skus'])){
  206. $skus = explode(',', $atts['skus']);
  207. $skus = array_map('trim', $skus);
  208. $args['meta_query'][] = array(
  209. 'key' => '_sku',
  210. 'value' => $skus,
  211. 'compare' => 'IN'
  212. );
  213. }
  214. if(isset($atts['ids'])){
  215. $ids = explode(',', $atts['ids']);
  216. $ids = array_map('trim', $ids);
  217. $args['post__in'] = $ids;
  218. }
  219. ob_start();
  220. $products = new WP_Query( $args );
  221. $woocommerce_loop['columns'] = $columns;
  222. if ( $products->have_posts() ) : ?>
  223. <?php woocommerce_product_loop_start(); ?>
  224. <?php while ( $products->have_posts() ) : $products->the_post(); ?>
  225. <?php woocommerce_get_template_part( 'content', 'product' ); ?>
  226. <?php endwhile; // end of the loop. ?>
  227. <?php woocommerce_product_loop_end(); ?>
  228. <?php endif;
  229. wp_reset_postdata();
  230. return ob_get_clean();
  231. }
  232. /**
  233. * Display a single prodcut
  234. *
  235. * @access public
  236. * @param array $atts
  237. * @return string
  238. */
  239. function woocommerce_product( $atts ) {
  240. if (empty($atts)) return;
  241. $args = array(
  242. 'post_type' => 'product',
  243. 'posts_per_page' => 1,
  244. 'no_found_rows' => 1,
  245. 'post_status' => 'publish',
  246. 'meta_query' => array(
  247. array(
  248. 'key' => '_visibility',
  249. 'value' => array('catalog', 'visible'),
  250. 'compare' => 'IN'
  251. )
  252. )
  253. );
  254. if(isset($atts['sku'])){
  255. $args['meta_query'][] = array(
  256. 'key' => '_sku',
  257. 'value' => $atts['sku'],
  258. 'compare' => '='
  259. );
  260. }
  261. if(isset($atts['id'])){
  262. $args['p'] = $atts['id'];
  263. }
  264. ob_start();
  265. $products = new WP_Query( $args );
  266. if ( $products->have_posts() ) : ?>
  267. <?php woocommerce_product_loop_start(); ?>
  268. <?php while ( $products->have_posts() ) : $products->the_post(); ?>
  269. <?php woocommerce_get_template_part( 'content', 'product' ); ?>
  270. <?php endwhile; // end of the loop. ?>
  271. <?php woocommerce_product_loop_end(); ?>
  272. <?php endif;
  273. wp_reset_postdata();
  274. return ob_get_clean();
  275. }
  276. /**
  277. * Display a single prodcut price + cart button
  278. *
  279. * @access public
  280. * @param array $atts
  281. * @return string
  282. */
  283. function woocommerce_product_add_to_cart( $atts ) {
  284. if (empty($atts)) return;
  285. global $wpdb, $woocommerce;
  286. if (!isset($atts['style'])) $atts['style'] = 'border:4px solid #ccc; padding: 12px;';
  287. if ($atts['id']) :
  288. $product_data = get_post( $atts['id'] );
  289. elseif ($atts['sku']) :
  290. $product_id = $wpdb->get_var($wpdb->prepare("SELECT post_id FROM $wpdb->postmeta WHERE meta_key='_sku' AND meta_value='%s' LIMIT 1", $atts['sku']));
  291. $product_data = get_post( $product_id );
  292. else :
  293. return;
  294. endif;
  295. if ($product_data->post_type=='product') {
  296. $product = $woocommerce->setup_product_data( $product_data );
  297. ob_start();
  298. ?>
  299. <p class="product" style="<?php echo $atts['style']; ?>">
  300. <?php echo $product->get_price_html(); ?>
  301. <?php woocommerce_template_loop_add_to_cart(); ?>
  302. </p><?php
  303. return ob_get_clean();
  304. } elseif ($product_data->post_type=='product_variation') {
  305. $product = get_product( $product_data->post_parent );
  306. $GLOBALS['product'] = $product;
  307. $variation = get_product( $product_data );
  308. ob_start();
  309. ?>
  310. <p class="product product-variation" style="<?php echo $atts['style']; ?>">
  311. <?php echo $product->get_price_html(); ?>
  312. <?php
  313. $link = $product->add_to_cart_url();
  314. $label = apply_filters('add_to_cart_text', __( 'Add to cart', 'woocommerce' ));
  315. $link = add_query_arg( 'variation_id', $variation->variation_id, $link );
  316. foreach ($variation->variation_data as $key => $data) {
  317. if ($data) $link = add_query_arg( $key, $data, $link );
  318. }
  319. printf('<a href="%s" rel="nofollow" data-product_id="%s" class="button add_to_cart_button product_type_%s">%s</a>', esc_url( $link ), $product->id, $product->product_type, $label);
  320. ?>
  321. </p><?php
  322. return ob_get_clean();
  323. }
  324. }
  325. /**
  326. * Get the add to cart URL for a product
  327. *
  328. * @access public
  329. * @param array $atts
  330. * @return string
  331. */
  332. function woocommerce_product_add_to_cart_url( $atts ){
  333. if (empty($atts)) return;
  334. global $wpdb;
  335. if ($atts['id']) :
  336. $product_data = get_post( $atts['id'] );
  337. elseif ($atts['sku']) :
  338. $product_id = $wpdb->get_var($wpdb->prepare("SELECT post_id FROM $wpdb->postmeta WHERE meta_key='_sku' AND meta_value='%s' LIMIT 1", $atts['sku']));
  339. $product_data = get_post( $product_id );
  340. else :
  341. return;
  342. endif;
  343. if ($product_data->post_type!=='product') return;
  344. $_product = get_product( $product_data );
  345. return esc_url( $_product->add_to_cart_url() );
  346. }
  347. /**
  348. * List all products on sale
  349. *
  350. * @access public
  351. * @param array $atts
  352. * @return string
  353. */
  354. function woocommerce_sale_products( $atts ){
  355. global $woocommerce_loop, $woocommerce;
  356. extract( shortcode_atts( array(
  357. 'per_page' => '12',
  358. 'columns' => '4',
  359. 'orderby' => 'title',
  360. 'order' => 'asc'
  361. ), $atts ) );
  362. // Get products on sale
  363. if ( false === ( $product_ids_on_sale = get_transient( 'wc_products_onsale' ) ) ) {
  364. $meta_query = array();
  365. $meta_query[] = array(
  366. 'key' => '_sale_price',
  367. 'value' => 0,
  368. 'compare' => '>',
  369. 'type' => 'NUMERIC'
  370. );
  371. $on_sale = get_posts(array(
  372. 'post_type' => array('product', 'product_variation'),
  373. 'posts_per_page' => -1,
  374. 'post_status' => 'publish',
  375. 'meta_query' => $meta_query,
  376. 'fields' => 'id=>parent'
  377. ));
  378. $product_ids = array_keys( $on_sale );
  379. $parent_ids = array_values( $on_sale );
  380. // Check for scheduled sales which have not started
  381. foreach ( $product_ids as $key => $id )
  382. if ( get_post_meta( $id, '_sale_price_dates_from', true ) > current_time('timestamp') )
  383. unset( $product_ids[ $key ] );
  384. $product_ids_on_sale = array_unique( array_merge( $product_ids, $parent_ids ) );
  385. set_transient( 'wc_products_onsale', $product_ids_on_sale );
  386. }
  387. $product_ids_on_sale[] = 0;
  388. $meta_query = array();
  389. $meta_query[] = $woocommerce->query->visibility_meta_query();
  390. $meta_query[] = $woocommerce->query->stock_status_meta_query();
  391. $args = array(
  392. 'posts_per_page'=> $per_page,
  393. 'orderby' => $orderby,
  394. 'order' => $order,
  395. 'no_found_rows' => 1,
  396. 'post_status' => 'publish',
  397. 'post_type' => 'product',
  398. 'orderby' => 'date',
  399. 'order' => 'ASC',
  400. 'meta_query' => $meta_query,
  401. 'post__in' => $product_ids_on_sale
  402. );
  403. ob_start();
  404. $products = new WP_Query( $args );
  405. $woocommerce_loop['columns'] = $columns;
  406. if ( $products->have_posts() ) : ?>
  407. <?php woocommerce_product_loop_start(); ?>
  408. <?php while ( $products->have_posts() ) : $products->the_post(); ?>
  409. <?php woocommerce_get_template_part( 'content', 'product' ); ?>
  410. <?php endwhile; // end of the loop. ?>
  411. <?php woocommerce_product_loop_end(); ?>
  412. <?php endif;
  413. wp_reset_postdata();
  414. return ob_get_clean();
  415. }
  416. /**
  417. * List best selling products on sale
  418. *
  419. * @access public
  420. * @param array $atts
  421. * @return string
  422. */
  423. function woocommerce_best_selling_products( $atts ){
  424. global $woocommerce_loop;
  425. extract( shortcode_atts( array(
  426. 'per_page' => '12',
  427. 'columns' => '4'
  428. ), $atts ) );
  429. $args = array(
  430. 'post_type' => 'product',
  431. 'post_status' => 'publish',
  432. 'ignore_sticky_posts' => 1,
  433. 'posts_per_page' => $per_page,
  434. 'meta_key' => 'total_sales',
  435. 'orderby' => 'meta_value',
  436. 'meta_query' => array(
  437. array(
  438. 'key' => '_visibility',
  439. 'value' => array( 'catalog', 'visible' ),
  440. 'compare' => 'IN'
  441. )
  442. )
  443. );
  444. ob_start();
  445. $products = new WP_Query( $args );
  446. $woocommerce_loop['columns'] = $columns;
  447. if ( $products->have_posts() ) : ?>
  448. <?php woocommerce_product_loop_start(); ?>
  449. <?php while ( $products->have_posts() ) : $products->the_post(); ?>
  450. <?php woocommerce_get_template_part( 'content', 'product' ); ?>
  451. <?php endwhile; // end of the loop. ?>
  452. <?php woocommerce_product_loop_end(); ?>
  453. <?php endif;
  454. wp_reset_postdata();
  455. return ob_get_clean();
  456. }
  457. /**
  458. * List top rated products on sale
  459. *
  460. * @access public
  461. * @param array $atts
  462. * @return string
  463. */
  464. function woocommerce_top_rated_products( $atts ){
  465. global $woocommerce_loop;
  466. extract( shortcode_atts( array(
  467. 'per_page' => '12',
  468. 'columns' => '4',
  469. 'orderby' => 'title',
  470. 'order' => 'asc'
  471. ), $atts ) );
  472. $args = array(
  473. 'post_type' => 'product',
  474. 'post_status' => 'publish',
  475. 'ignore_sticky_posts' => 1,
  476. 'orderby' => $orderby,
  477. 'order' => $order,
  478. 'posts_per_page' => $per_page,
  479. 'meta_query' => array(
  480. array(
  481. 'key' => '_visibility',
  482. 'value' => array('catalog', 'visible'),
  483. 'compare' => 'IN'
  484. )
  485. )
  486. );
  487. ob_start();
  488. add_filter( 'posts_clauses', 'woocommerce_order_by_rating_post_clauses' );
  489. $products = new WP_Query( $args );
  490. remove_filter( 'posts_clauses', 'woocommerce_order_by_rating_post_clauses' );
  491. $woocommerce_loop['columns'] = $columns;
  492. if ( $products->have_posts() ) : ?>
  493. <?php woocommerce_product_loop_start(); ?>
  494. <?php while ( $products->have_posts() ) : $products->the_post(); ?>
  495. <?php woocommerce_get_template_part( 'content', 'product' ); ?>
  496. <?php endwhile; // end of the loop. ?>
  497. <?php woocommerce_product_loop_end(); ?>
  498. <?php endif;
  499. wp_reset_postdata();
  500. return ob_get_clean();
  501. }
  502. /**
  503. * Output featured products
  504. *
  505. * @access public
  506. * @param array $atts
  507. * @return string
  508. */
  509. function woocommerce_featured_products( $atts ) {
  510. global $woocommerce_loop;
  511. extract(shortcode_atts(array(
  512. 'per_page' => '12',
  513. 'columns' => '4',
  514. 'orderby' => 'date',
  515. 'order' => 'desc'
  516. ), $atts));
  517. $args = array(
  518. 'post_type' => 'product',
  519. 'post_status' => 'publish',
  520. 'ignore_sticky_posts' => 1,
  521. 'posts_per_page' => $per_page,
  522. 'orderby' => $orderby,
  523. 'order' => $order,
  524. 'meta_query' => array(
  525. array(
  526. 'key' => '_visibility',
  527. 'value' => array('catalog', 'visible'),
  528. 'compare' => 'IN'
  529. ),
  530. array(
  531. 'key' => '_featured',
  532. 'value' => 'yes'
  533. )
  534. )
  535. );
  536. ob_start();
  537. $products = new WP_Query( $args );
  538. $woocommerce_loop['columns'] = $columns;
  539. if ( $products->have_posts() ) : ?>
  540. <?php woocommerce_product_loop_start(); ?>
  541. <?php while ( $products->have_posts() ) : $products->the_post(); ?>
  542. <?php woocommerce_get_template_part( 'content', 'product' ); ?>
  543. <?php endwhile; // end of the loop. ?>
  544. <?php woocommerce_product_loop_end(); ?>
  545. <?php endif;
  546. wp_reset_postdata();
  547. return ob_get_clean();
  548. }
  549. /**
  550. * Show a single product page
  551. *
  552. * @access public
  553. * @param array $atts
  554. * @return string
  555. */
  556. function woocommerce_product_page_shortcode( $atts ) {
  557. if (empty($atts)) return;
  558. if (!$atts['id'] && !$atts['sku']) return;
  559. $args = array(
  560. 'posts_per_page' => 1,
  561. 'post_type' => 'product',
  562. 'post_status' => 'publish',
  563. 'ignore_sticky_posts' => 1,
  564. 'no_found_rows' => 1
  565. );
  566. if(isset($atts['sku'])){
  567. $args['meta_query'][] = array(
  568. 'key' => '_sku',
  569. 'value' => $atts['sku'],
  570. 'compare' => '='
  571. );
  572. }
  573. if(isset($atts['id'])){
  574. $args['p'] = $atts['id'];
  575. }
  576. $single_product = new WP_Query( $args );
  577. ob_start();
  578. while ( $single_product->have_posts() ) : $single_product->the_post(); wp_enqueue_script( 'wc-single-product' ); ?>
  579. <div class="single-product">
  580. <?php woocommerce_get_template_part( 'content', 'single-product' ); ?>
  581. </div>
  582. <?php endwhile; // end of the loop.
  583. wp_reset_postdata();
  584. return ob_get_clean();
  585. }
  586. /**
  587. * Show messages
  588. *
  589. * @access public
  590. * @param array $atts
  591. * @return string
  592. */
  593. function woocommerce_messages_shortcode() {
  594. ob_start();
  595. woocommerce_show_messages();
  596. return ob_get_clean();
  597. }
  598. /**
  599. * woocommerce_order_by_rating_post_clauses function.
  600. *
  601. * @access public
  602. * @param mixed $args
  603. * @return void
  604. */
  605. function woocommerce_order_by_rating_post_clauses( $args ) {
  606. global $wpdb;
  607. $args['where'] .= " AND $wpdb->commentmeta.meta_key = 'rating' ";
  608. $args['join'] .= "
  609. LEFT JOIN $wpdb->comments ON($wpdb->posts.ID = $wpdb->comments.comment_post_ID)
  610. LEFT JOIN $wpdb->commentmeta ON($wpdb->comments.comment_ID = $wpdb->commentmeta.comment_id)
  611. ";
  612. $args['orderby'] = "$wpdb->commentmeta.meta_value DESC";
  613. $args['groupby'] = "$wpdb->posts.ID";
  614. return $args;
  615. }
  616. /**
  617. * Shortcode creation
  618. **/
  619. add_shortcode('product', 'woocommerce_product');
  620. add_shortcode('product_page', 'woocommerce_product_page_shortcode');
  621. add_shortcode('product_category', 'woocommerce_product_category');
  622. add_shortcode('product_categories', 'woocommerce_product_categories');
  623. add_shortcode('add_to_cart', 'woocommerce_product_add_to_cart');
  624. add_shortcode('add_to_cart_url', 'woocommerce_product_add_to_cart_url');
  625. add_shortcode('products', 'woocommerce_products');
  626. add_shortcode('recent_products', 'woocommerce_recent_products');
  627. add_shortcode('sale_products', 'woocommerce_sale_products');
  628. add_shortcode('best_selling_products', 'woocommerce_best_selling_products');
  629. add_shortcode('top_rated_products', 'woocommerce_top_rated_products');
  630. add_shortcode('featured_products', 'woocommerce_featured_products');
  631. add_shortcode('woocommerce_cart', 'get_woocommerce_cart');
  632. add_shortcode('woocommerce_checkout', 'get_woocommerce_checkout');
  633. add_shortcode('woocommerce_order_tracking', 'get_woocommerce_order_tracking');
  634. add_shortcode('woocommerce_my_account', 'get_woocommerce_my_account');
  635. add_shortcode('woocommerce_edit_address', 'get_woocommerce_edit_address');
  636. add_shortcode('woocommerce_change_password', 'get_woocommerce_change_password');
  637. add_shortcode('woocommerce_lost_password', 'get_woocommerce_lost_password');
  638. add_shortcode('woocommerce_view_order', 'get_woocommerce_view_order');
  639. add_shortcode('woocommerce_pay', 'get_woocommerce_pay');
  640. add_shortcode('woocommerce_thankyou', 'get_woocommerce_thankyou');
  641. add_shortcode('woocommerce_messages', 'woocommerce_messages_shortcode');