Cart - Use permalinks to pre-load the cart

Hi Everyone,

I’m just adding a further note on this thread with the URL structure that worked for me.

I benefited from the helpful examples above, but needed to do a slight modification to the above to get this working for me.

I wanted a URL which would

  • Clear the current cart
  • Add multiple items, potentially with a specific quantity of each
  • Take the user to the cart page (not the start of checkout).

The URL I used to achieve this was:

https://www.yourshop.com/cart/clear?return_to=/cart/update?updates[36959969804442]=2%26updates[36959969575066]=4

The key learning/amendment from the above comments for me was that rather than an ampersand character (&) in the URL I needed to encode that character to %26 and use that instead to get multiple variants added to the new cart. Otherwise only the first item was being added to the cart.

Hope it helps someone else.

5 Likes