Hide fields from the vendor store manager
-
Hello,
I need to hide some features/fields from the store manager form of the vendors, such as price, sale price, from, Upto, virtual checkbox and downloadable checkbox.
And where can I add a new custom fields in that form/page?Thank you!
-
You may do this easily from WCFM Capability setting – https://docs.wclovers.com/capability/
Thank you for your respond,
But the capability settings doesn’t have the features that allow me to hide the fields in the Add Product window, So, may you provide to me a code or filters that will remove the following fields in the vendor store manager > add product window:
– Price
– Sale Price
– Virtual
– Downloadable
– Schedule fields
– Short description
– policy tab label
– shipping policy
– refund policy
– Cancellation/Return/Exchange PolicyThank you
Are you using only WCFM Free addon?
Yes I am using the free plugin of WCFM
However, I’ve seen in the forums that there’s a coding solving for these issues, such as filter and unset php statements, but I’m not familiar with php, So I hope to get a solving like that.OK, no issues. Add these snippets to your site –
add_filter( 'wcfm_is_allow_policy_product_settings', '__return_false' ); add_filter( 'wcfm_product_manage_fields_general', function( $general_fields, $product_id, $product_type ) { $general_fields = wcfm_hide_field( 'is_virtual', $general_fields ); $general_fields = wcfm_hide_field( 'is_downloadable', $general_fields ); return $general_fields; }, 50, 3 ); add_filter( 'wcfm_product_manage_fields_pricing', function( $pricing_fields, $product_id, $product_type ) { $general_fields = wcfm_hide_field( 'regular_price', $general_fields ); $general_fields = wcfm_hide_field( 'sale_price', $general_fields ); $general_fields = wcfm_hide_field( 'sale_date_from', $general_fields ); $general_fields = wcfm_hide_field( 'sale_date_upto', $general_fields ); return $pricing_fields; }, 50, 3 ); add_filter( 'wcfm_product_manage_fields_content', function( $product_fields, $article_id ) { if( isset( $product_fields['excerpt'] ) ) { $product_fields['excerpt']['type'] = 'textarea'; $product_fields = wcfm_hide_field( 'excerpt', $product_fields ); } return $product_fields; }, 50, 2);Add custom code(s) to your child theme’s functions.php
In case you do not have child theme then add those using this plugin –Â https://wordpress.org/plugins/code-snippets/Thank you so much for your support
The codes worked very well.I think that the price field is still appear, how do I remove it?
Which price fields are still visible, show me a screenshot please.
Yes, sure
Please use this revised code snippet –
add_filter( 'wcfm_is_allow_policy_product_settings', '__return_false' ); add_filter( 'wcfm_product_manage_fields_general', function( $general_fields, $product_id, $product_type ) { $general_fields = wcfm_hide_field( 'is_virtual', $general_fields ); $general_fields = wcfm_hide_field( 'is_downloadable', $general_fields ); return $general_fields; }, 50, 3 ); add_filter( 'wcfm_product_manage_fields_pricing', function( $pricing_fields, $product_id, $product_type ) { $pricing_fields = wcfm_hide_field( 'regular_price', $pricing_fields ); $pricing_fields = wcfm_hide_field( 'sale_price', $pricing_fields ); $pricing_fields = wcfm_hide_field( 'sale_date_from', $pricing_fields ); $pricing_fields = wcfm_hide_field( 'sale_date_upto', $pricing_fields ); return $pricing_fields; }, 50, 3 ); add_filter( 'wcfm_product_manage_fields_content', function( $product_fields, $article_id ) { if( isset( $product_fields['excerpt'] ) ) { $product_fields['excerpt']['type'] = 'textarea'; $product_fields = wcfm_hide_field( 'excerpt', $product_fields ); } return $product_fields; }, 50, 2);Thank you so much
The code has worked perfectlyGlad to hear, you are always welcome.
If you get a chance then please leave a review for me 🙂
Hi @wclovers,
Could you please show me the code to hide these fields for my custom_product_type only ? I used this code you provided to create my custom_product and need to remove the downloadable and virtual fields from this product_type !
add_filter( 'wcfm_product_types', function( $pro_types ) { $pro_types['crowdfunding'] = __( 'Crowdfunding', 'woocommerce' ); return $pro_types; }, 50 );I cannot find this solution anywhere so really need some help with this.
Thanks 🙂
The topic ‘Hide fields from the vendor store manager’ is closed to new replies.