Hi. How can we help?

Remove products in the Wishlist after ask for an estimate

With the following code, the wishlist will be empty after click on ask for an estimate button.

if(class_exists('YITH_WCWL')) {
if (!function_exists('yith_wcwl_after_ask_an_estimate_remove_wishlist')) {
function yith_wcwl_after_ask_an_estimate_remove_wishlist($url, $wishlist_id, $additional_notes, $reply_email, $session)
{

$args['wishlist_token'] = $wishlist_id;

$wishlist_products = YITH_WCWL()->get_products($args);

foreach ($wishlist_products as $wishlist_product) {

YITH_WCWL()->details['remove_from_wishlist'] = $wishlist_product['prod_id'];
YITH_WCWL()->details['wishlist_id'] = $wishlist_id;
YITH_WCWL()->remove();
}

return $url;
}

add_filter('yith_wcwl_after_ask_an_estimate_redirect', 'yith_wcwl_after_ask_an_estimate_remove_wishlist', 10, 5);
}
}
Was this article helpful?
1 out of 3 found this helpful

Back to Help Center >