Exemple #1
0
    unset($_POST['gform_form_id']);
}
// Handles all ajax requests pertaining to this plugin
require_once 'safe-wp-load.php';
require_once 'functions.yith-wcwl.php';
header("Cache-Control: no-cache, must-revalidate");
// HTTP/1.1
header("Expires: Sat, 26 Jul 1997 05:00:00 GMT");
// Date in the past
if (!isset($yith_wcwl)) {
    $yith_wcwl = new YITH_WCWL($_REQUEST);
}
// Remove product from the wishlist
if ($_GET['action'] == 'remove_from_wishlist') {
    $count = yith_wcwl_count_products();
    if ($yith_wcwl->remove($_GET['wishlist_item_id'])) {
        _e('Product successfully removed.', 'yit');
    } else {
        echo '#' . $count . '#';
        _e('Error. Unable to remove the product from the wishlist.', 'yit');
    }
    if (!$count) {
        _e('No products were added to the wishlist', 'yit');
    }
    wp_redirect($yith_wcwl->get_wishlist_url());
    die;
} elseif ($_GET['action'] == 'add_to_wishlist') {
    $return = $yith_wcwl->add();
    if ($return == 'true') {
        echo $return . '##' . __('Product added!', 'yit');
    } elseif ($return == 'exists') {