简体   繁体   中英

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!

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM