Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- add_filter( 'wcfm_form_custom_validation', function($form_data, $wcfm_screen) {
- $error = [];
- if ('product_manage' == $wcfm_screen) {
- $minimum_price = 1;
- if ( isset($form_data['regular_price']) && isset($form_data['sale_price']) ) {
- $regular_price = $form_data['regular_price'] ? $form_data['regular_price'] : 0;
- $sale_price = $form_data['sale_price'] ? $form_data['sale_price'] : 0;
- if (min($regular_price,$sale_price) < $minimum_price) {
- $error['has_error'] = true;
- $error['message'] = sprintf(__('Price can not be less than %1$s%2$s', 'wc-frontend-manager'), get_woocommerce_currency_symbol(), $minimum_price);
- }
- }
- }
- return !empty($error) ? $error : $form_data;
- }, 10, 2 );
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement