L
L
Leonid2018-05-11 10:55:09
WordPress
Leonid, 2018-05-11 10:55:09

Online payment for an order in WooCommerce after moderation - ready-made solutions (plugins)?

The WooCommerce online store requires the following payment algorithm:
1) The buyer, as usual, places an order on the site, but does not pay anything
2) The manager processes the order and sets the order status, for example: "Waiting for payment"
3) The buyer receives an E-mail- notification with a link, by clicking on which he proceeds to pay for his order.
I understand that you can do everything yourself - but as usual, suddenly tell me a ready-made (even paid) solution that will save time?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
L
Leonid, 2018-06-12
@easycode

Everything turned out to be quite simple:
For example, you can do this:

function receipt_page($order_id) {

      	global $woocommerce;
      	$this->order = new WC_Order($order_id);

      // если заказ не помечен как готовый к оплате, то меняем статус на "Обработка" и перекидываем на страницу с уведомлением! 
      if (get_post_meta( $this->order->id, 'ready_to_pay', true) != 1) {
      		$woocommerce->cart->empty_cart();
      		$this->order->update_status('processing');
      		wp_redirect( home_url( '/' ) ); // заменить на URL-адрес страницы с текстом: "Ваш заказ поступил в обработку..."
        return false;
      	}

and then if the order status changes to "Awaiting payment", then:
add_action( 'woocommerce_order_status_pending', function ($order_id) {
  update_post_meta( $order_id, 'ready_to_pay', 1);
});

I
Igor Vorotnev, 2018-05-11
@HeadOnFire

https://woocommerce.com/products/woocommerce-order...
The plugin allows you to create your own custom statuses (Pending Payment in your case) and change the process (that is, the order of transitions between statuses).

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question