Anyone here ever had the need to add the AJAX add to cart button (the one located on product archives) on a custom query post output?
Do you mind sharing the hook? I can't seem to find the correct one.
Digging through the code, it's pretty straight-forward to find.
First, look at the template used for product archives -
But when it actually starts looping through each product, it delegates the work to
The part we care about is the last action:
Digging even deeper, and it looks like this function is the one you need.
How to Add It
The easiest way to use this function is to call it directly. Just know that it requires to parameters,
The function itself calls its own
|show 4 more comments|