Fisnik KurtiAll builds

Test build on my demo store

Cart rewards and add-ons

A test inside the cart drawer: a reward track for the store's two bundle savings and free shipping, and two small add-ons under the items.

Control: the cart drawer with one candle.
Control
Variant: the same cart with the reward track at the top and two add-ons under the items.
Variant

The brief

  • Show shoppers in the cart how far they are from the next bundle saving and from free shipping.
  • Offer two small add-ons that fit the order.
  • The drawer already runs a free-shipping bar test. The two must never show together, and the control drawer must not change at all.

How I built it

  • Liquid and CSS inside the drawer's own re-render, with no extra script for the track. It updates with the cart on every quantity change.
  • The two saving steps mirror the store's automatic discounts: 2 items save 10%, 3 items save 15%. They live in theme settings, so the merchant changes them in one place.
  • The “You save” line reads the cart's own discount, so it can't disagree with the checkout.
  • Add-ons come from a list the merchant picks. A product already in the cart never shows, and the add goes through the theme's own product form.
  • After an add, keyboard focus moves to the next add button instead of jumping to the top of the drawer.
  • Both pieces ship hidden. One class on the page shows them, and the free-shipping bar test has its own class, so the testing tool runs the two as separate experiences.
The switch CSS
.cart-rewards--b { display: none; }

.ab-demo07-b .cart-rewards--b,
.shopify-design-mode .cart-rewards--b { display: grid; }

That is all the testing tool needs. The second selector keeps the piece visible and editable in the theme editor.

Counting from the cart Liquid
assign saving_count = 0
for item in cart.items
  assign item_collections = item.product.collections | map: 'handle'
  if item_collections contains saving_collection.handle
    assign saving_count = saving_count | plus: item.quantity
  endif
endfor

Only items from the bundle collection count toward a saving, read again on every re-render of the drawer.

The checks

  • Control drawer before and after the build: 190 elements in the same place and size at 390 and 1440 px, and 0 pixels different at 1440.
  • The free-shipping bar test on its own still shows only its bar.
  • Nine carts where the track and the “You save” line equal the cart's own numbers to the cent. Two candles: save €5,20. Three bars: save €6,75 and €1,75 to free shipping. Five items: save €14,40.
  • An add from the row, with the keyboard and with reduced motion.
  • 375, 768, 1440 and 2560 px wide: no sideways scroll and nothing outside the drawer.

The handover note

What the team gets with the preview links, written the way I send it.

Test
Cart rewards and add-ons, in the cart drawer.
Switch
The class ab-demo07-b on <html>. Keep it apart from the free-shipping bar test (ab-demo02-b): one visitor, one of the two.
Try
Raise the quantity to 2 and the track reaches 10%, to 3 for 15%. Add an add-on from the row: it leaves the row and focus moves to the next one.
Settings
Theme settings → Cart rewards and add-ons: the collection, the two steps and the add-on list.
Checked
375 to 2560 px, nine carts to the cent, keyboard, reduced motion. Control unchanged.

After launch

This is my own demo store, so there is no traffic and no result to show. On a client store this is where the test runs in the testing tool, and if it wins I roll it into the theme and take the test code out.

All buildsfisi.kurti@gmail.com