Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // Validation - if user hasn't selected a product addon, then alert them to this
- // Place this in functions.php
- function product_addons_validation( $passed, $product_id ) {
- if ( empty( $_REQUEST['addon-' . $product_id . '-field-name'] )) {
- wc_add_notice( __( 'Product-Addon Error Message.', 'woocommerce' ), 'error' );
- $passed = false;
- }
- return $passed;
- }
- add_action( 'woocommerce_add_to_cart_validation', 'product_addons_validation', 10, 5 );
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement