Multi Vendor Marketplace Plugin | WCFM Marketplace › Forums › WCFM – Marketplace (WooCommerce Multivendor Marketplace) › Vendor maximum price
- This topic has 3 replies, 2 voices, and was last updated 5 years, 2 months ago by WCFM Forum.
Viewing 3 reply threads
- AuthorPosts
- October 14, 2019 at 8:23 pm #86883M MaxParticipant
I want the vendor could only sell products for a maximum price € 30.
How can I fix this pricing? - October 16, 2019 at 12:42 pm #87105WCFM ForumMember
OK, what type of products you are allowing to create by vendors?
- October 21, 2019 at 8:34 pm #88106M MaxParticipant
Single & Variable products.
- October 23, 2019 at 12:24 pm #88470WCFM ForumMember
HI,
Please use this code to your site –
add_filter( 'wcfm_form_custom_validation', function( $wcfm_products_manage_form_data, $form_manager ) { if( $form_manager == 'product_manage' ) { if( $wcfm_products_manage_form_data['product_type'] == 'simple' ) { $regular_price = isset( $wcfm_products_manage_form_data['regular_price'] ) ? wc_clean( $wcfm_products_manage_form_data['regular_price'] ) : ''; if( $regular_price && ( $regular_price > 30 ) ) { $custom_validation_results['has_error'] = true; $custom_validation_results['message'] = 'Product maximum price should not be more than 30'; return $custom_validation_results; } } elseif( $wcfm_products_manage_form_data['product_type'] == 'variable' ) { if(isset($wcfm_products_manage_form_data['variations']) && !empty($wcfm_products_manage_form_data['variations'])) { foreach($wcfm_products_manage_form_data['variations'] as $variations) { $regular_price = isset( $variations['regular_price'] ) ? wc_clean( $variations['regular_price'] ) : ''; if( $regular_price && ( $regular_price > 30 ) ) { $custom_validation_results['has_error'] = true; $custom_validation_results['message'] = 'Product maximum price should not be more than 30'; return $custom_validation_results; } } } } } return $wcfm_products_manage_form_data; }, 50 , 2 );
Add this code to your child theme’s functions.php
In case you do not have child theme then add code using this plugin – https://wordpress.org/plugins/code-snippets/Thank You
- AuthorPosts
Viewing 3 reply threads
- The topic ‘Vendor maximum price’ is closed to new replies.