S
S
Sergey Zhukovsky2016-03-07 12:28:59
WordPress
Sergey Zhukovsky, 2016-03-07 12:28:59

How to remove redirect to cart in Woocommerce?

Friends, help me solve the problem with WooCommerce
I sell a digital product. Accordingly, I do not want the user to accidentally add it 2 times to the basket and then resent that the payment is 2 times more expensive.
I enabled the following option in the settings:
0de5f1573ae84e92ae89ae207af3a9df.png
Everything seems to be ok. Now the product is not added 2 times. But when you add it again, the inscription appears:
45dc324e359c452383c3e5f28af29f73.pngHow can I make this inscription not appear, but immediately go to the order step, but without adding a second copy of the product?
If you disable this option, then everything works fine, but the product is added again and the amount increases.
I sell goods through a landing page, not through a store, so the link on the landing page leads directly to the order page. But this problem arises with the inscription, which misleads the user when he did not buy the first time, and then caught up with him through retargeting.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
S
serkamikadze, 2016-08-06
@serkamikadze

There was a similar task, it was necessary to place an order immediately upon purchase
. Decided to empty the basket before adding the product.

function so_validate_add_cart_item( $passed, $product_id, $quantity, $variation_id = '', $variations= '' ) {
    global $woocommerce;
    $woocommerce->cart->empty_cart();
    return $passed;
}
add_filter( 'woocommerce_add_to_cart_validation', 'so_validate_add_cart_item', 10, 5 );

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question