• Resolved sebbs121

    (@sebbs121)


    Hello,

    I try to add products via custom endpoint. It always works with first product, but nexts are not added. Code below:

    $product_id = 558;
    $vid = 347;
    WC()->session = new WC_Session_Handler();
    WC()->session->init();
    WC()->customer = new WC_Customer( get_current_user_id(), true );
    WC()->cart = new WC_Cart();
    WC()->cart->add_to_cart($product_id, 1);

    Anyone experienced this before? Thanks in advance.

Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘WooCommerce can’t add more than 1 product’ is closed to new replies.