Programatically add to cart from a template

  • Hello,

    I would like my customers to be able to add all the items from a previous order to the cart. I was trying to get this working by using the perch_shop_add_to_cart() function and passing the productID and quantity of the items.

    I tried the following, but it only outputs the function as text and not as a php function:

    1. <perch:orderitems>
    2. perch_shop_add_to_cart(<perch:orderitem id="productID" />,<perch:orderitem id="quantity" />)
    3. </perch:orderitems>

    Now I was thinking of looping through the amount of items in the order, and calling perch_shop_add_to_cart() for every item, but I am stuck at this point. How could I loop through the amount of items in the cart (not the quantity, but the different items).