woocommerce_loop_add_to_cart_link

The woocommerce_loop_add_to_cart_link filter receives the HTML for a product's purchase link in WooCommerce's classic loop/add-to-cart.php template. Its callback can modify the markup, but must return an HTML string rather than print it. The template supplies three arguments:

$linkExisting link markup (string)
$productCurrent WC_Product object
$argsArray of arguments used to generate the link
SourceWooCommerce loop add-to-cart template

Wrap the original link

add_filter( 'woocommerce_loop_add_to_cart_link', function ( $link, $product, $args ) {
    return '<span class="catalog-cart-link">' . $link . '</span>';
}, 10, 3 );

The wrapper adds a styling target while retaining the existing link's destination, label, classes, quantity attribute, and other attributes. Use the returned $link as trusted WooCommerce markup; escape any new dynamic text you introduce. Install the callback in a site-specific plugin or child theme's functions.php, then check shop and category pages.

Product types and rendering paths

A catalog link does not always add a product directly to the cart. Variable products, for example, can link to a product page to select options. Replacing all links with a fixed add-to-cart URL could break those flows or discard accessibility and AJAX-related attributes. HoverCraft styles these links in its shop layout, so preserve the underlying markup when possible.

This filter belongs to the classic PHP template. Some block-based product listings render purchase controls differently; verify the actual output before relying on the filter in a block layout.