• After upgrading from Woocommerce 2.2.1.1 to the latest version, this line $woocommerce->cart->add_to_cart( $post_id ); in a plugin file fails and hangs. I have checked the cart manually and although the cart is emptied, it isn’t subsequently updated with the correct product.

    This is the chunk of code:

    global $woocommerce; [Works]
    $woocommerce->cart->empty_cart(); [Works]
    $woocommerce->cart->add_to_cart( $post_id ); [Fails & Hangs]

    Any suggestions welcome!

    https://www.ads-software.com/plugins/woocommerce/

Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
  • The topic ‘Manual add_to_cart() not working in 2.3.x (worked in 2.2.x)’ is closed to new replies.