Skip to content

Instantly share code, notes, and snippets.

@noellesteegs
Last active August 26, 2019 12:34
Show Gist options
  • Save noellesteegs/9b6d35a0bac141d874d766878c95b548 to your computer and use it in GitHub Desktop.
Save noellesteegs/9b6d35a0bac141d874d766878c95b548 to your computer and use it in GitHub Desktop.
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