Multi Vendor Marketplace Plugin | WCFM Marketplace › Forums › WCFM – Ultimate › About Toolset with variable product question
Tagged: Toolset variable product
- This topic has 23 replies, 2 voices, and was last updated 6 years, 3 months ago by WCFM Forum.
- AuthorPosts
- August 2, 2018 at 2:48 am #27448
- August 2, 2018 at 3:59 am #27455MOHOParticipant
I have solved this problem, i should use Taxonomy.
You could closed this entry, thanks.
- August 4, 2018 at 4:59 am #27557WCFM ForumMember
OK, that’s fine π
- August 4, 2018 at 6:15 am #27573
- August 4, 2018 at 6:31 am #27588WCFM ForumMember
Hi,
It’s not possible, Toolset or WooCommerce none of them support this.
If you really want to have custom field for variations then we have to develop this custom, no third plugin can be helpful here.
Thank You
- August 4, 2018 at 8:29 pm #27634MOHOParticipant
Yes i need “custom field for variations”
I need three number fields as follows:
1. Wholesale Price
2. Cost Price (Required)
3. Maximum Points DiscountI make our custom point reward system, so i need “custom field for variations”.
Thanks.
Attachments:
You must be logged in to view attached files. - August 5, 2018 at 5:15 pm #27713WCFM ForumMember
Hi,
OK, I understand your requirement.
Kindly know me, are you using any plugin for the purpose?
Thank You
- August 6, 2018 at 2:21 am #27718MOHOParticipant
No plugin could add field at variations option, right?
I need three number fields at each variation options as follows:
1. Wholesale Price ( meta:_wc_wholesale_price ) –> i custom field
2. Cost Price “Required field” ( meta:_wc_cost_price ) –> i custom field
3. Maximum Points Discount ( meta:_wc_points_max_discount ) –> this woo point plugin fieldCould you custom it for me?
Attachments:
You must be logged in to view attached files. - August 6, 2018 at 7:58 am #27751MOHOParticipant
i need add one more field: “Enable Wholesale Price” option field (yes|no) (meta:_wc_enable_wholesale_price)
If vendor choose “yes”, then display ” Wholesale Price” field
If vendor choose “no”, then hide ” Wholesale Price” fieldMaximum Points Discount field default value = “0”
About translate custom field
Enable Wholesale Price β εη¨ηΆι·εΉ (yes|no β ζ―|ε¦)
Wholesale Price β ηΆι·εΉ
Cost Price β εΊθ²¨εΉ
Maximum Points Discount β ζ΅η¨ιζι«δΈιIf
Wholesale Price < Cost Price
Cost Price < Maximum Points Discount
then display error message - August 6, 2018 at 10:56 am #27767WCFM ForumMember
Hi,
Kindly know me which plugin you are using for the purpose!
Thank You
- August 6, 2018 at 10:51 pm #27805MOHOParticipantThis reply has been marked as private.
- August 8, 2018 at 3:58 am #27870WCFM ForumMember
HI,
We are going to make compatible WCFM with this wholesale plugin – https://wordpress.org/plugins/wholesale-market/
Do you ever tried this?
Thank You
- August 8, 2018 at 5:05 am #27881MOHOParticipant
I try it, but now i no need Wholesale Price.
I use my custom plugin for point count, so i only need variable option add extra two field, can save my meta field:
1. Cost Price β εΊθ²¨εΉ (number field)
2. Maximum Points Discount β ζ΅η¨ιζι«δΈι (number field) - August 8, 2018 at 5:10 am #27885WCFM ForumMember
Hi,
PFA, a code snippet which help you to add-save custom field for simple and variable products.
Please try this.
thank you
Attachments:
You must be logged in to view attached files. - August 8, 2018 at 6:18 am #27898
- August 8, 2018 at 6:39 am #27901WCFM ForumMember
Hi,
Just add this code then, it will add a new variation field “MRP Price” –
// Adding variation field function wcfm_product_manage_fields_variations_mpr( $variation_fileds, $variations, $variation_shipping_option_array, $variation_tax_classes_options ) { global $WCFM, $WCFMu; $mrp_price_fields = array( "mrp_price" => array('label' => __('MRP Price', 'wc-frontend-manager-ultimate') , 'type' => 'text', 'class' => 'wcfm-text wcfm_ele variable', 'label_class' => 'wcfm_title wcfm_ele variable' ), ); $variation_fileds = array_merge( $variation_fileds, $mrp_price_fields); return $variation_fileds; } add_filter( 'wcfm_product_manage_fields_variations', 'wcfm_product_manage_fields_variations_mpr', 100, 4 ); // Adding variation field data function wcfm_product_data_variations_mrp( $variations, $variation_id, $variation_id_key ) { global $WCFM, $WCFMu; if( $variation_id ) { $variations[$variation_id_key]['mrp_price'] = get_post_meta( $variation_id, 'mrp_price', true ); } return $variations; } add_filter( 'wcfm_variation_edit_data', 'wcfm_product_data_variations_mrp', 100, 3 ); // Saving variation field data function wcfm_product_variation_save_mrp( $wcfm_variation_data, $new_product_id, $variation_id, $variations, $wcfm_products_manage_form_data ) { global $WCFM, $WCFMu; if( $variation_id ) { update_post_meta( $variation_id, 'mrp_price', $variations[ 'mrp_price' ] ); } return $wcfm_variation_data; } add_filter( 'wcfm_product_variation_data_factory', 'wcfm_product_variation_save_mrp', 100, 5 );
Thank You
- August 8, 2018 at 7:12 am #27905
- August 8, 2018 at 7:15 am #27907WCFM ForumMember
Hi,
This is also possible, then you have to tweak this code a bit and add field at particular position.
Can you do this? OR should I write that code for you?
Thank You
- August 8, 2018 at 7:29 am #27908
- August 8, 2018 at 8:51 am #27921MOHOParticipant
and how could make field required?
- August 9, 2018 at 1:26 am #27954MOHOParticipant
Hi i think no need move custom field position, just “make field required”, thanks.
- August 9, 2018 at 3:11 pm #28042WCFM ForumMember
Hi,
OK, for this kindly update this line –
$mrp_price_fields = array( "mrp_price" => array('label' => __('MRP Price', 'wc-frontend-manager-ultimate') , 'type' => 'text', 'class' => 'wcfm-text wcfm_ele variable', 'label_class' => 'wcfm_title wcfm_ele variable' ), );
with this –
$mrp_price_fields = array( "mrp_price" => array('label' => __('MRP Price', 'wc-frontend-manager-ultimate') , 'custom_attributes' => array( 'required' => true ), 'type' => 'text', 'class' => 'wcfm-text wcfm_ele variable', 'label_class' => 'wcfm_title wcfm_ele variable' ), );
I have added a new element in array – ‘custom_attributes’ => array( ‘required’ => true )
In WCFM if you add this to any field then it will become “Required” and validation automatically start working.
Hope this will helpful for you π
Thank You
- August 9, 2018 at 4:14 pm #28063MOHOParticipant
thanks, it work now!
please close it. - August 9, 2018 at 4:16 pm #28065WCFM ForumMember
Great π
- AuthorPosts
- The topic ‘About Toolset with variable product question’ is closed to new replies.