문제

Is there any public function to add a product in to the shopping cart from a custom module? Or do I need to do some hard coding to achieve that? All the product info comes from a query, however im not able to figure out how to add it to the shopping cart.

Any ideas are welcome.

도움이 되었습니까?

해결책

Okay I figured it out.

Here is the code for future generations who are going to need similar help.

    $Cart = $this->context->cart; // can be achieved through cookies aswell, a matter of opinion
    $Cart->updateQty($quantity, $id_product, $id_product_attribute = null, $id_customization = false, $operator = 'up', $id_address_delivery = 0, $shop = null, $auto_add_cart_rule = true);
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top