V
V
Viktor Viktorov2019-07-22 19:58:30
WooCommerce
Viktor Viktorov, 2019-07-22 19:58:30

How to disable pre-order in WooCommerce?

Hello! It is necessary to prohibit the pre-order of goods that are not in stock, even if the pre-order is allowed in the product card itself in the admin panel. Please tell me how to do it?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
P
Pychev Anatoly, 2019-07-22
@pton

the most logical thing is to change the values ​​in the product card in the admin panel
Well, if through the code, look towards the hook woocommerce_add_to_cart_validation. It is called just before the item is added to the cart. And take a look at the function wc_protected_product_add_to_cartif you want to display something to the user (why he can’t add the product to the cart)
But, it’s better to exclude the possibility of adding than to inform why it can’t be added.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question