Multi Vendor Marketplace Plugin | WCFM Marketplace › Forums › WCFM – Marketplace (WooCommerce Multivendor Marketplace) › Vendor Bank Details in Purchase Confirmation
- This topic has 6 replies, 3 voices, and was last updated 4 years, 7 months ago by klub.
- AuthorPosts
- March 23, 2020 at 6:03 pm #112808alexdeziParticipant
Hi! I would like to send the vendors bank details to the buyer, so 100% of the payment is going directly to the vendor.
I have seen this code snippet in another plugin which adds the provided vendor bank details in the purchase confirmation and email confirmations.
Can this be done with WCFM?This is the code – I also tested it and it works fine:
https://wordpress.org/support/topic/shopping-directly-from-the-vendor-and-excluding-the-commission/Thank you!
- April 2, 2020 at 8:47 pm #114778WCFM ForumMember
Hi,
Add this code to your site for the purpose –
function wcfmmp_vendor_customer_pay_option( $vendor_id ) { global $WCFM, $WCFMmp; $active_order_payment_methods = get_wcfm_marketplace_disallow_order_payment_methods(); $wcfm_preferred_customer_payment = get_user_meta( $vendor_id, 'wcfm_preferred_customer_payment', true ); $wcfm_customer_payment_options = get_user_meta( $vendor_id, 'wcfm_customer_payment_options', true ); if( did_action( 'wcfm_vendor_settings_after_shipping' ) ) { ?> <!-- collapsible --> <div class="page_collapsible" id="wcfm_settings_form_min_order_amount_head"> <label class="wcfmfa fa-cart-plus"></label> <?php _e('Customer Pay Option', 'wc-frontend-manager'); ?><span></span> </div> <div class="wcfm-container"> <div id="wcfm_settings_form_vendor_invoice_expander" class="wcfm-content"> <?php } else { ?> <div class="wcfm_clearfix"></div> <div class="wcfm_vendor_settings_heading"><h2><?php _e('Customer Pay Option', 'wc-frontend-manager'); ?></h2></div> <div class="wcfm_clearfix"></div> <div class="store_address"> <?php } ?> <?php $WCFM->wcfm_fields->wcfm_generate_form_field( array( "wcfm_preferred_customer_payment" => array('label' => __('Preferred Payment Method', 'wc-frontend-manager'), 'type' => 'select', 'class' => 'wcfm-select wcfm_ele', 'label_class' => 'wcfm_title wcfm_ele', 'options' => $active_order_payment_methods, 'value' => $wcfm_preferred_customer_payment ), "wcfm_customer_payment_options" => array('label' => __('Payment Details', 'wc-frontend-manager'), 'type' => 'textarea', 'class' => 'wcfm-textarea wcfm_ele wcfm_full_ele', 'label_class' => 'wcfm_title wcfm_ele wcfm_full_ele_title', 'value' => $wcfm_customer_payment_options ), ) ); ?> </div> <?php if( did_action( 'wcfm_vendor_settings_after_shipping' ) ) { ?> </div> <?php } ?> <div class="wcfm_clearfix"></div> <!-- end collapsible --> <?php } add_action( 'wcfm_vendor_settings_after_shipping', 'wcfmmp_vendor_customer_pay_option', 500 ); add_action( 'wcfmmp_admin_wcfm_vendor_commission_payment_settings_after', 'wcfmmp_vendor_customer_pay_option', 500 ); add_action( 'wcfm_vendor_settings_update', function( $vendor_id, $wcfm_settings_form ) { global $WCFM, $WCFMmp; if( isset( $wcfm_settings_form['wcfm_preferred_customer_payment'] ) ) { $wcfm_preferred_customer_payment = $wcfm_settings_form['wcfm_preferred_customer_payment']; update_user_meta( $vendor_id, 'wcfm_preferred_customer_payment', $wcfm_preferred_customer_payment ); } if( isset( $wcfm_settings_form['wcfm_customer_payment_options'] ) ) { $wcfm_customer_payment_options = $wcfm_settings_form['wcfm_customer_payment_options']; update_user_meta( $vendor_id, 'wcfm_customer_payment_options', $wcfm_customer_payment_options ); } }, 500, 2 ); function wcfmmp_vendor_order_customer_payment_options( $order ) { global $WCFM, $WCFMmp; if( function_exists('is_wcfm_page') && is_wcfm_page() ) return; echo "<br /><br />"; echo "<h2 style='font-size: 18px; color: #17a2b8; line-height: 20px;margin-top: 6px;margin-bottom: 10px;padding: 0px;text-decoration: underline;'>" . __( 'Payment Details:', 'wc-frontend-manager-ultimate' ) . "</h2>"; echo "<table width='100%' style='width:100%;'><tbody>"; $line_items = $order->get_items( apply_filters( 'woocommerce_purchase_order_item_types', 'line_item' ) ); $line_items = apply_filters( 'wcfm_valid_line_items', $line_items, $order->get_id() ); $processed_vendor_ids = array(); foreach ( $line_items as $item_id => $item ) { $product_id = $item->get_product_id(); $vendor_id = wcfm_get_vendor_id_by_post( $product_id ); if( !$vendor_id || !wcfm_is_vendor( $vendor_id ) ) continue; if( ( apply_filters( 'wcfm_is_allow_order_item_policies_by_vendor', true ) || !apply_filters( 'wcfm_is_show_marketplace_itemwise_orders', true ) ) && in_array( $vendor_id, $processed_vendor_ids ) ) continue; $processed_vendor_ids[$vendor_id] = $vendor_id; if( wcfm_is_vendor() && ( $vendor_id != $WCFMmp->vendor_id ) ) continue; $wcfm_customer_payment_options = get_user_meta( $vendor_id, 'wcfm_customer_payment_options', true ); if( !$wcfm_customer_payment_options ) continue; $wcfm_preferred_customer_payment = get_user_meta( $vendor_id, 'wcfm_preferred_customer_payment', true ); if( $wcfm_preferred_customer_payment && ( $wcfm_preferred_customer_payment != $order->get_payment_method() ) ) continue; $store_name = wcfm_get_vendor_store_name( $vendor_id ); ?> <tr> <td colspan="3" style="background-color: #eeeeee;padding: 1em 1.41575em;line-height: 1.5;font-weight:600;"> <?php if( apply_filters( 'wcfm_is_allow_order_item_policies_by_vendor', true ) || !apply_filters( 'wcfm_is_show_marketplace_itemwise_orders', true ) ) { echo $store_name . ' '; $gross_sales = $WCFM->wcfm_vendor_support->wcfm_get_gross_sales_by_vendor( $vendor_id, '', false, $order->get_id() ); echo "<br />Payable Amount: " . wc_price( $gross_sales ); } else { echo get_the_title( $product_id ) . ' ('. $store_name .') '; } ?> </td> <td colspan="5" style="background-color: #f8f8f8;padding: 1em;"><?php echo wpautop($wcfm_customer_payment_options); ?></td> </tr> <?php } echo "</tbody></table>"; echo "<br /><br /><br /><br />"; } add_action( 'woocommerce_order_details_after_order_table', 'wcfmmp_vendor_order_customer_payment_options', 50 ); add_action( 'woocommerce_email_order_meta', 'wcfmmp_vendor_order_customer_payment_options', 50 ); add_action( 'wcfm_store_invoice_vendor_info_after', function( $vendor_id, $order_id, $order, $document ) { $wcfm_customer_payment_options = get_user_meta( $vendor_id, 'wcfm_customer_payment_options', true ); if( $wcfm_customer_payment_options ) { $wcfm_preferred_customer_payment = get_user_meta( $vendor_id, 'wcfm_preferred_customer_payment', true ); if( $wcfm_preferred_customer_payment && ( $wcfm_preferred_customer_payment == $order->get_payment_method() ) ) { echo '<br /><div class="vendor-shop-phone"><b>Payment Options -</b><br />' . wpautop($wcfm_customer_payment_options) . '</div><br />'; } } }, 50, 4 ); add_filter( 'wcfm_is_allow_wc_default_email_customer_details', '__return_true' ); add_filter( 'wcfm_is_show_marketplace_itemwise_orders', '__return_false' );
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/Now, vendor has to set there preferred customer payment method ans details from their setting -> Customer Pay Options tab – https://ibb.co/NSyWRty
Thank You
- April 4, 2020 at 1:18 am #115181klubParticipant
hi guys
i add this code but on order i get store bank accoun and also vendor banckaccoun. How to show just vednor bank account ?
we have also premium plugins from you if this info can help with custom code.
thx - April 5, 2020 at 10:23 am #115538WCFM ForumMember
Hi,
i add this code but on order i get store bank accoun and also vendor banckaccoun. How to show just vednor bank account ?
– Do you have added vendor’s Bank details from their setting -> Customer Pay options?
Thank You
- April 5, 2020 at 12:35 pm #115569klubParticipantThis reply has been marked as private.
- April 5, 2020 at 12:59 pm #115574WCFM ForumMember
Hi,
Please remove bank details from WooCommerce payment setting. Is this really required for you?
Thank You
- April 8, 2020 at 12:26 am #116511klubParticipant
thx dear firend.
- AuthorPosts
- The topic ‘Vendor Bank Details in Purchase Confirmation’ is closed to new replies.