Jump to content

Recommended Posts

I am beginner in opencart, realized adding two gift items to the cart, along with adding the first paid

if (!$json) {
				$this->cart->add($this->request->post['product_id'], $quantity, $option, $recurring_id);

			$cart_contents = $this->cart->countProducts();
			if ($cart_contents == 1) {
    			$this->cart->add('656', '1');
				$this->cart->add('657', '1');
			}
}

Help to implement the removal of these two products along with the last paid from the cart. Here is my attempt (doesn't work)

if (isset($this->request->post['key'])) {
			$this->cart->remove($this->request->post['key']);

 $cart_contents = $this->cart->countProducts();

		 if (isset($this->request->post['product_id'])) {
			 if ($cart_contents == 3) {
				 $this->cart->remove($this->request->post['product_id']);
    			 $this->cart->remove('656');
				 $this->cart->remove('657');
			 }
		 }


 

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

  • Recently Browsing   0 members

    No registered users viewing this page.

×