Wordpress store is using WooCommerce, and I have a small purchase note that I need to appear on WooCommerce Checkout, but only when a certain product is being purchased.
I have added a custom message that now appears below the Place Order button. However its showing up no matter what is in the cart.
This is the code I currently have in place:
add_action( 'woocommerce_after_checkout_form', 'allclean_add_checkout_content', 12 );
function allclean_add_checkout_content() {
echo '<div class="checkoutdisc">Custom message appears here fine.</div>';
}
Is there a simple code that I can add before this line, that makes it only apply when a certain category product is in the cart?
Thanks
I think you need to check the cart contents.
Here is the code:
In this case the code will be a little bit different:
This code goes in function.php file of your active child theme (or theme) or also in any plugin file.
This code is tested and works.