shortcode_wrapper('woocommerce_pay', $atts); } /** * Outputs the pay page - payment gateways can hook in here to show payment forms etc **/ function woocommerce_pay() { global $woocommerce, $order; if ( isset($_GET['pay_for_order']) && isset($_GET['order']) && isset($_GET['order_id']) ) : // Pay for existing order $order_key = urldecode( $_GET['order'] ); $order_id = (int) $_GET['order_id']; $order = new woocommerce_order( $order_id ); if ($order->id == $order_id && $order->order_key == $order_key && in_array($order->status, array('pending', 'failed'))) : // Set customer location to order location if ($order->billing_country) $woocommerce->customer->set_country( $order->billing_country ); if ($order->billing_state) $woocommerce->customer->set_state( $order->billing_state ); if ($order->billing_postcode) $woocommerce->customer->set_postcode( $order->billing_postcode ); // Show form woocommerce_get_template('checkout/pay_for_order.php'); elseif (!in_array($order->status, array('pending', 'failed'))) : $woocommerce->add_error( __('Your order has already been paid for. Please contact us if you need assistance.', 'woocommerce') ); $woocommerce->show_messages(); else : $woocommerce->add_error( __('Invalid order.', 'woocommerce') ); $woocommerce->show_messages(); endif; else : // 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 = ''; if ($order_id > 0) : $order = new woocommerce_order( $order_id ); if ($order->order_key == $order_key && in_array($order->status, array('pending', 'failed'))) : ?> payment_method, $order_id ); ?>
add_error( __('Your order has already been paid for. Please contact us if you need assistance.', 'woocommerce') ); $woocommerce->show_messages(); endif; else : $woocommerce->add_error( __('Invalid order.', 'woocommerce') ); $woocommerce->show_messages(); endif; endif; }