Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save allegrabottlik/280dbe63aa0a07b788c81f07382981b9 to your computer and use it in GitHub Desktop.
Save allegrabottlik/280dbe63aa0a07b788c81f07382981b9 to your computer and use it in GitHub Desktop.
Removes all Amazon saved for later items on the cart page. It will only remove visible items. You might want to scroll first to make more items visible. To use paste code in developer console (Ctrl+Shift+J or Cmd+Opt+J in Chrome) then press enter.
## currently not working ##
function moveToWishList() {
var query = document.querySelectorAll("#sc-saved-cart input[value='Move to Wish List']")
if (query.length) {
query[0].click();
}
var query2 = document.querySelectorAll("#registry-3O6MPC8BWUEPE a")
if (query2.length) {
query2[0].click();
}
if (query.length > 1) {
setTimeout(moveToWishList,10000);
}
else {
console.log('Finished');
}
}
moveToWishList();
@allegrabottlik
Copy link
Author

Amazon has added a checkbox to the left of items in Cart, and so this is broken again.

@allegrabottlik
Copy link
Author

Michael's original I started with:

function deleteSavedItems() {
var query = document.querySelectorAll("#sc-saved-cart input[value=Delete]")
if (query.length) {
query[0].click();
}
if (query.length > 1) {
setTimeout(deleteSavedItems,100);
}
else {
console.log('Finished');
}
}
deleteSavedItems();

@allegrabottlik
Copy link
Author

Updates from recent comment on gist I originally forked from: [(https://gist.github.com/MichaelLawton/ec73c321d62d1b4eaf0f51ca478ccd92?permalink_comment_id=4639550#gistcomment-4639550)].

`avagian commented last week
Thanks @MichaelLawton and @mhujsak
Amazon has changed a little bit, here is the modified "Add to list" instead of "Move to Wish List" Version
you can get XXXXXXXXXXXX from your list URL as well https://www.amazon.com/hz/wishlist/ls/XXXXXXXXXXXX
I'll load it all and will leave it overnight. But if 10000 is very slow for you, modify it to a lower number.
p.s. deleteSavedItems works fine without any mod

function moveToWishList() {
var query = document.querySelectorAll("#sc-saved-cart input[value='Add to list']")
if (query.length) {
query[0].click();
}
var query2 = document.querySelectorAll("#cldd-list-name-XXXXXXXXXXXX")
if (query2.length) {
query2[0].click();
}
if (query.length > 1) {
setTimeout(moveToWishList,10000);
}
else {
console.log('Finished');
}
}
moveToWishList();`

@allegrabottlik
Copy link
Author

allegrabottlik commented Aug 3, 2023

function moveToWishList() {
var query = document.querySelectorAll("#sc-saved-cart input[value='Add to list']")
if (query.length) {
query[0].click();
}
var query2 = document.querySelectorAll("#cldd-list-name-3O6MPC8BWUEPE")
if (query2.length) {
query2[0].click();
}
if (query.length > 1) {
setTimeout(moveToWishList,10000);
}
else {
console.log('Finished');
}
}
moveToWishList();

@allegrabottlik
Copy link
Author

try using zoom in browser to get more items per page

@allegrabottlik
Copy link
Author

Turn off any Chrome extensions running on the page to speed up

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment