Best Multi Vendor Marketplace Plugin for WordPress › Forums › WCFM – Ultimate › How could i limit price and custom field read only at live product
Tagged: read only price field
- This topic has 2 replies, 2 voices, and was last updated 6 years, 11 months ago by
MOHO.
Viewing 2 reply threads
- AuthorPosts
- August 3, 2018 at 5:29 am #27529
MOHO
ParticipantWhen vendor submit product as “live, then limit vendor can’t edit price.
1. Variable product
every price and sale price of all variable options2. Toolset custom field
You have give me simple product code, these price and custom field also need, thanks.
By Moho
Attachments:
You must be logged in to view attached files. - August 4, 2018 at 6:19 am #27576
WCFM Forum
MemberHi,
Here is your code for disabling Variation prices –
function wcfm_restrict_publish_product_variation_pricing( $variation_fileds, $variations, $variation_shipping_option_array, $variation_tax_classes_options, $products_array ) { global $wp; $product_id = 0; if( isset( $wp->query_vars['wcfm-products-manage'] ) && !empty( $wp->query_vars['wcfm-products-manage'] ) ) { $product_id = absint( $wp->query_vars['wcfm-products-manage'] ); } if( $product_id ) { if( get_post_status( $product_id ) == 'publish' ) { if( !current_user_can( 'administrator' ) ) { if( isset( $variation_fileds['regular_price'] ) ) { $variation_fileds['regular_price']['attributes'] = array( 'readonly' => true ); } if( isset( $variation_fileds['sale_price'] ) ) { $variation_fileds['sale_price']['attributes'] = array( 'readonly' => true ); } } } } return $variation_fileds; } add_filter( 'wcfm_product_manage_fields_variations', 'wcfm_restrict_publish_product_variation_pricing', 50, 5 );
I am checking how this can be done for Toolset fields!
Thank You
- August 6, 2018 at 10:43 pm #27803
MOHO
Participantthanks it work. please close it.
- AuthorPosts
Viewing 2 reply threads
- The topic ‘How could i limit price and custom field read only at live product’ is closed to new replies.