Cart: Quick View
Key: cart-quick
Some stores, when you add a product to the cart, display a minimized view of the cart, or simply a view of the latest product line item added.
Tracking this is similar to tracking the cart itself, but we have to wait for it to be available on the page as follows:
{
"gross": SET_TO_VALUE,
...
"doIf": CONDITIONALS,
"waitForChange": GET_A_VALUE, // not optional for cart-quick
"action": ACTION,
"loop": LOOP_VALUE,
"loop-item": {
...
}
}
The loop and data work the same as for the normal cart tracking.
doIf
This is the same as for product quick view. It only waits for a "quick cart" view if these conditions are met. For example, it may only run on the category or product pages:
"doIf": {
"lookAt": "state.page.type",
"tests": "$value == 'cat' || $value == 'prod'"
}
waitForChange
This should get a JS value from the page, or using jQuery. When the scraper first runs it saves this value, and only does the quick cart if this changes. See Lookups.
Note that this could run multiple times on a page if the user adds more than one product.
The example here gets the current cart value (using a jQuery selector) and if the value changes assumes that a quick cart is visible.
"waitForChange": {
"type": "selector",
"value": "#cart-value span",
"filters": "text,number"
}
ACTION
Please see the documentation on "cartAction".