woocommerce_after_add_to_cart_button
Fires right after the Add to cart button on single product pages, still inside the form. Use it for links or short notes.
When it fires
WooCommerce fires this action straight after the Add to cart button, before the closing tag, on single product pages. It's in the add to cart templates for simple, variable, grouped and external products.
The global $product is available, so you can check the product's type, category or stock before printing anything.
Parameters
None. Your callback takes no arguments.
Example: Add a size guide link for clothing
add_action( 'woocommerce_after_add_to_cart_button', function () {
global $product;
if ( ! $product instanceof WC_Product || ! has_term( 'clothing', 'product_cat', $product->get_id() ) ) {
return;
}
printf(
'<a class="size-guide-link" href="%1$s">%2$s</a>',
esc_url( home_url( '/size-guide/' ) ),
esc_html__( 'Size guide', 'my-snippets' )
);
} );
Good to know
- Block themes: the Add to Cart + Options block fires this hook as well.
- To add something below the whole form instead, use woocommerce_after_add_to_cart_form.