Appearance
Reorder tag
Available from v4.0.0
A form that adds products the customer ordered before to the cart again: one product (e.g. Renew next to a license) or all products of an order (Order again). Each product in the cart gets the ordered product as its parent, so the new order links back to the order it came from. The order pages in the CP show this as a history, see Order page.
The products are added for their current price: the Price field (and the Sale price field) of the channel settings of their channel, never the price of the old order. Set the Price field for every product channel: without it, or with an empty price or a value that isn't a number like 12.50, the reorder tag skips the product and logs it. Price rules (Store Price Rule) are applied by the cart, the rules that apply now.
A discount for reorders and renewals: a Store discount with the condition type Reorders and renewals, or a rule of Store Price Rule with Only reorders and renewals.
The name is the current name of the product. The custom fields, modifier options, SKU and weight are the ones of the order, and the quantity of the order (or the qty param). The price of a modifier option is the price of the order, the Store doesn't know the current price of a modifier (it is set in the add_to_cart tag of the template). The note and the max_qty of the add_to_cart tag are not copied. A product whose entry was deleted or closed is skipped.
Only paid orders of the visitor can be reordered: an order of the logged in member, or a guest order when its hash is given (an order id can be guessed, the hash can't). An order that is not paid, or was cancelled, refunded or charged back doesn't count. The free products of a Buy X Get Y Free rule are not added, the rule adds them again. Otherwise the tag shows its {if no_results}.
The tag
{exp:reinos_store:reorder}
<button type="submit">Order again</button>
{/exp:reinos_store:reorder}Tag Parameters
Give one of order_item_id, order_id or hash.
order_item_id
Add one product of an order to the cart again, e.g. {order:items:order_item_id} in the {order:items} loop of the order or orders tag.
order_item_id=""order_id
Add all products of the order to the cart again. For an order of the logged in member.
order_id=""hash
Add all products of the order with this hash to the cart again, e.g. {order:hash}. Also for a guest order. Combined with order_item_id, only that product is added.
hash=""qty
The quantity to add of each product. Leave it out (or 0) for the quantity of the order.
qty="1"clear_cart
Empty the cart before the products are added.
clear_cart="yes"return_url
Where to go after the products are added, e.g. the cart. Default the current url. When no product could be added, the customer returns to the form.
return_url="/reinos_store/cart"form_class, form_id, form_attr:[name]
The class, the id and other attributes of the form.
form_class="reorder" form_attr:data-type="reorder"Tag Variables
The variables have the reinos_store: prefix (or your own with the prefix param).
items_count
The number of products the form adds.
{reinos_store:items_count}error:out_of_stock
Set after a submit when one or more products were out of stock (and not added).
{if reinos_store:error:out_of_stock}Some products are out of stock.{/if}error:not_available
Set after a submit when one or more products are no longer available: the entry was deleted or closed, the product has no current price (the Price field of its channel settings is empty), or the order was cancelled or refunded after the page was shown.
{if reinos_store:error:not_available}Some products are no longer available.{/if}Examples
All products of an order, on the order page of the customer:
{exp:reinos_store:order hash="{segment_3}"}
{exp:reinos_store:reorder hash="{order:hash}" return_url="/reinos_store/cart"}
<button type="submit">Order again</button>
{if reinos_store:error:out_of_stock}<small>Some products are out of stock.</small>{/if}
{/exp:reinos_store:reorder}
{/exp:reinos_store:order}Renew one product, e.g. a license, in the order history of a member:
{exp:reinos_store:orders member_id="{logged_in_member_id}"}
{order:items}
{order:items:name}
{if order:items:reorder_order_id}
Renewed in order #{order:items:reorder_order_id}
{if:else}
{exp:reinos_store:reorder order_item_id="{order:items:order_item_id}" qty="1" return_url="/reinos_store/checkout"}
<button type="submit">Renew</button>
{/exp:reinos_store:reorder}
{/if}
{/order:items}
{/exp:reinos_store:orders}