WooCommerce add to cart validation: prevent add to cart

后端 未结 3 1694
离开以前
离开以前 2021-02-06 16:42

I have a probleme with woocommerce that im trying to fix for few days.

I am creating a website for a guy and he wanted me to add a custom input on the product page, I cou

3条回答
  •  终归单人心
    2021-02-06 17:05

    I had this issue and after much trial and error the fix was to adjust the $priority parameter (10 is default) in :

    add_filter( 'woocommerce_add_to_cart_validation', 'add_the_date_validation', 10, 5 );
    

    As per usual, I tried everything else first...changed this to 15 and bingo..! I guess it was running ahead of code ranked lower priority, which then let items into cart.

提交回复
热议问题