Answer the question
In order to leave comments, you need to log in
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:
Everything seems to be ok. Now the product is not added 2 times. But when you add it again, the inscription appears:
How 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
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 questionAsk a Question
731 491 924 answers to any question