Sankar V
Sankar V

Reputation: 4128

Opencart: How to remove a product from wish list after successful checkout?

I saw that in Opencart the wish list has got 2 options: "Delete" and "Add to Cart", but even after adding the product to Cart and purchasing the product the product still exists in wish list.

Is it possible to automatically remove the product from wish list after the purchasing the product?

Please help me. Thanks in Advance!

Upvotes: 0

Views: 2099

Answers (1)

secondman
secondman

Reputation: 3277

Open file:

catalog/controller/checkout/cart.php

Find the line:

$this->cart->add($this->request->post['product_id'], $quantity, $option);

After that add this:

if (isset($this->session->data['wishlist'])):
    $key = array_search($this->request->post['product_id'], $this->session->data['wishlist']);

    if ($key !== false) {
        unset($this->session->data['wishlist'][$key]);
    }
endif;

Tested and works.

Upvotes: 3

Related Questions