L
L
ligisayan2015-09-22 13:19:30
PHP
ligisayan, 2015-09-22 13:19:30

Why is it not cleared after paying for the goods and returning to the basket?

There is a wordpress + woocommerce store. After paying with a card for the selected order using the return to cart button, it is not cleared. If you add a line of code:

<?php global $woocommerce; $woocommerce->cart->empty_cart(); ?>

then only the cart page is cleared, which is redirected to, but the product actually remains in the cart anyway. What can be done? Function to return to cart:
/**
     * Process the payment and return the result
    **/
    function process_payment( $order_id ) {

        $order  = wc_get_order( $order_id );

        return array(
            'result' => 'success',
            'redirect'  => $order->get_checkout_payment_url( true )
        );
    }

Answer the question

In order to leave comments, you need to log in

1 answer(s)
0
0leg5ergeev, 2015-09-22
@0leg5ergeev

After card payment

Some kind of payment plugin?

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question