WooCommerce add to cart validation: prevent add to cart

后端 未结 3 1687
离开以前
离开以前 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:11

    Yes, sorry i'am new in this forum. However i have found a solution, i have edit directly class-wc-cart.php at line 900, and i have copy the function before the if:

    if($passed!=false)
    {
        do_action( 'woocommerce_add_to_cart', $cart_item_key, $product_id, $quantity, $variation_id, $variation, $cart_item_data );
    }
    

    Now for me it works, i know that isn't the most correct solution but for the moment it works, i have only to be careful when i will update woocommerce

提交回复
热议问题