Advertisement
Guest User

Untitled

a guest
Mar 27th, 2017
41
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.44 KB | None | 0 0
  1. // Validation - if user hasn't selected a product addon, then alert them to this
  2. // Place this in functions.php
  3. function product_addons_validation( $passed, $product_id ) {
  4. if ( empty( $_REQUEST['addon-' . $product_id . '-field-name'] )) {
  5. wc_add_notice( __( 'Product-Addon Error Message.', 'woocommerce' ), 'error' );
  6. $passed = false;
  7. }
  8. return $passed;
  9. }
  10. add_action( 'woocommerce_add_to_cart_validation', 'product_addons_validation', 10, 5 );
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement