List Eight Sleep cart items
Automatically list Eight Sleep cart items on eightsleep.com. List the lines of the Eight Sleep US guest cart in this browser: each line's id, product id, offer id, name, seller, quantity, unit price and line price, plus the item count and the cart total before tax, in US dollars. A browser with no cart gives an empty list and a total of 0. Pass a line id to eightsleep.com/remove_from_cart.
Inputs
None
Output
count requiredNumber of items in the cart: the sum of the line quantities.
lines requiredtotal requiredCart total before tax, in US dollars.
FAQ
Remove a line from the Eight Sleep cart
Remove one line, with all its quantity, from the Eight Sleep US guest cart of this browser, and return the cart after the change. Get line ids from eightsleep.com/list_cart_items. When the cart has no such line, the cart does not change and removed is false.
Add an Eight Sleep offer to the cart
Add one Eight Sleep US offer (a size, zone or pack option of a product) to the guest cart of this browser, in the quantity given, and return the cart after the add with the product id, offer id and name of the line added. Get offer ids from eightsleep.com/get_product. An offer id that the store does not sell, or a quantity below 1, is refused before the cart changes. The script does not add the items the site asks for with some products, for example the Autopilot plan with a Pod, and it does not go to checkout.
Get Eight Sleep product and its offers
Read one Eight Sleep US product page: name, description, category, photos, star rating and review count, and every offer the store sells for it (size, zone or pack option) with its offer id, SKU, price, price before discount, discount codes and stock state, in US dollars. Pass the offer id to eightsleep.com/add_to_cart. Get product ids from eightsleep.com/list_products; the Pod is pod-cover. A product id with no page gives an error that says so.
