Advertisement
Guest User

Untitled

a guest
Jun 17th, 2019
64
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.97 KB | None | 0 0
  1. function johnproject_save_check_shipping( $post_id ) {
  2.  
  3. if(!is_valid_shipping_destination($_POST["attribute_values"][1][0], $_POST["attribute_values"][2][0]))
  4. $error = $WP_Error("broke","Your product does not qualify for shipping. Please review your specifications carefully and try again.");
  5.  
  6. return false
  7.  
  8. }
  9. add_action( 'save_post', 'johnproject_save_check_shipping' );
  10.  
  11. function johnproject_presave_check_shipping( $data ) {
  12.  
  13. if(!is_valid_shipping_destination($_POST["attribute_values"][1][0], $_POST["attribute_values"][2][0]))
  14. $error = $WP_Error("broke","Your product does not qualify for shipping. Please review your specifications carefully and try again.");
  15.  
  16.  
  17. return $data;
  18. }
  19.  
  20. add_filter( 'wp_insert_post_data', 'johnproject_presave_check_shipping' );
  21.  
  22. function is_valid_shipping_destination($productType,$productVariation)
  23. {
  24. // for test purposes, always return false to see if errors are reported on product page
  25. return false;
  26. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement