Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Add text above cart form @ WooCommerce single product if in particular category
add_action( 'woocommerce_before_add_to_cart_form', 'category_notice' );
function category_notice() {
if (has_term('accessories', 'product_cat')) { // Replace 'accessories' with your category
echo '<div class="category_notice"><p>This is a notice.</p></div>';
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.