Multi Vendor Marketplace Plugin | WCFM Marketplace › Forums › WC Vendors › Add Custom Fields on Vendor Store "Home"
- This topic has 3 replies, 2 voices, and was last updated 5 years, 6 months ago by WCFM Forum.
- AuthorPosts
- June 9, 2019 at 7:36 am #66566thiemann.kParticipant
Hey Community,
I would like to let sellers create their own terms and conditions and their own imprint.
In the dashboard under “Policies Setting” so far, information can be provided on “Shipping Policy”, “Exchange Policy” and “Cancellation / Exchange / Return Policy”. https://ibb.co/jTnmv4N
I would like to extend this to the two fields: “Terms” and “Imprint”.
In the shop view under “https: // your-domain / store / vendor-store / policies /” there is the tab “Policies”.
Here you should then please the previously added fields are displayed.Definitely with a snippet to solve.
Thank you!!!
- June 11, 2019 at 5:08 pm #67019WCFM ForumMember
HI,
Please add this code to your child theme’s functions.php –
add_filter( 'wcfm_vendor_settings_fields_policies', function( $policy_fields, $vendor_id ) { $_wcfm_vendor_payment_policy = wcfm_get_user_meta( $vendor_id, 'wcfm_vendor_payment_policy', true ); $rich_editor = apply_filters( 'wcfm_is_allow_rich_editor', 'rich_editor' ); $wpeditor = apply_filters( 'wcfm_is_allow_product_wpeditor', 'wpeditor' ); if( $wpeditor && $rich_editor ) { $rich_editor = 'wcfm_wpeditor'; } else { $wpeditor = 'textarea'; } $policy_fields['payment_policy'] = array('label' => __('Terms and Imprint', 'wc-frontend-manager'), 'type' => $wpeditor, 'class' => 'wcfm-textarea wcfm_ele wcfm_full_ele wcfm_custom_field_editor ' . $rich_editor, 'label_class' => 'wcfm_title wcfm_full_title', 'value' => $_wcfm_vendor_payment_policy ); return $policy_fields; }, 50, 2 ); add_action( 'wcfm_vendor_settings_update', function( $vendor_id, $wcfm_settings_form ) { if( isset( $wcfm_settings_form['payment_policy'] ) ) { wcfm_update_user_meta( $vendor_id, 'wcfm_vendor_payment_policy', $wcfm_settings_form['payment_policy'] ); } }, 20, 2 ); add_action( 'wcfmmp_store_after_policies', function( $vendor_id ) { $_wcfm_vendor_payment_policy = wcfm_get_user_meta( $vendor_id, 'wcfm_vendor_payment_policy', true ); if( !wcfm_empty( $_wcfm_vendor_payment_policy ) ) { ?> <div class="policies_area wcfm-payment-policies"> <h2 class="wcfm_policies_heading"><?php echo apply_filters('wcfm_payment_policies_heading', __('Terms and Imprint', 'wc-frontend-manager')); ?></h2> <div class="wcfm_policies_description" ><?php echo $_wcfm_vendor_payment_policy; ?></div> </div> <?php } }, 50 ); add_action( 'wcfm_policy_content_after', function( $product_id ) { global $WCFM; $vendor_id = $WCFM->wcfm_vendor_support->wcfm_get_vendor_id_from_product( $product_id ); if( $vendor_id ) { $_wcfm_vendor_payment_policy = wcfm_get_user_meta( $vendor_id, 'wcfm_vendor_payment_policy', true ); if( !wcfm_empty( $_wcfm_vendor_payment_policy ) ) { ?> <div class="wcfm-payment-policies"> <h2 class="wcfm_policies_heading"><?php echo apply_filters('wcfm_payment_policies_heading', __('Terms and Imprint', 'wc-frontend-manager')); ?></h2> <div class="wcfm_policies_description" ><?php echo $_wcfm_vendor_payment_policy; ?></div> </div> <?php } } }, 50 ); add_action( 'wcfm_order_details_policy_content_after', function( $vendor_id ) { $_wcfm_vendor_payment_policy = wcfm_get_user_meta( $vendor_id, 'wcfm_vendor_payment_policy', true ); if( !wcfm_empty( $_wcfm_vendor_payment_policy ) ) { ?> <tr> <th colspan="3" style="background-color: #eeeeee;padding: 1em 1.41575em;line-height: 1.5;"><strong><?php echo apply_filters('wcfm_payment_policies_heading', __('Terms and Imprint', 'wc-frontend-manager')); ?></strong></th> <td colspan="5" style="background-color: #f8f8f8;padding: 1em;"><?php echo $_wcfm_vendor_payment_policy; ?></td> </tr> <?php } }, 50 ); add_action( 'wcfm_store_invoice_policy_content_after', function( $product_id ) { global $WCFM; $vendor_id = $WCFM->wcfm_vendor_support->wcfm_get_vendor_id_from_product( $product_id ); if( $vendor_id ) { $_wcfm_vendor_payment_policy = wcfm_get_user_meta( $vendor_id, 'wcfm_vendor_payment_policy', true ); if( !wcfm_empty( $_wcfm_vendor_payment_policy ) ) { ?> <tr> <th colspan="3" style="background-color: #eeeeee;padding: 1em 1.41575em;line-height: 1.5;"><?php echo apply_filters('wcfm_payment_policies_heading', __('Terms and Imprint', 'wc-frontend-manager')); ?></th> <td colspan="5" style="background-color: #f8f8f8;padding: 1em;"><?php echo $_wcfm_vendor_payment_policy; ?></td> </tr> <?php } } }, 50 );
Thank You
- June 12, 2019 at 3:00 am #67113thiemann.kParticipant
Wow! just great!!! …it looks so easy….. Thank you!!!
- June 12, 2019 at 5:29 am #67120WCFM ForumMember
My pleasure 🙂
- AuthorPosts
- You must be logged in to reply to this topic.