This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//Transaction charge fully bear by vendors. Admin will not contribute | |
add_filter( 'wcfmmp_commission_deducted_transaction_charge', function($transaction_charge, $vendor_id, $product_id, $order_id, $total_commission, $commission_rule ) { | |
global $WCFMmp; | |
$transacton_charge_meta_key = '_wcfmmp_vendor_transacton_charge_'.$vendor_id.'_'.$product_id; | |
if($transaction_charge = get_post_meta( $order_id, $transacton_charge_meta_key, true )) { | |
return $transaction_charge; | |
} | |
$order = wc_get_order( $order_id ); | |
$vendors = array(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
add_filter('wcfmmp_free_shipping_minimum_order_amount', function($min_amount, $vendor_id) { | |
$wcfmmp_shipping = get_user_meta( $vendor_id, '_wcfmmp_shipping', true ); | |
$shipping_type = isset( $wcfmmp_shipping['_wcfmmp_user_shipping_type'] ) ? $wcfmmp_shipping['_wcfmmp_user_shipping_type'] : ''; | |
if ( ! $wcfmmp_shipping || empty( $shipping_type ) || $shipping_type == 'by_zone' ) | |
return $min_amount; | |
if( apply_filters( 'wcfmmp_is_allow_free_shipping_coupon', true ) ) { | |
$has_free_coupon = false; | |
$coupons = WC()->cart->get_coupons(); | |
if ( $coupons ) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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'; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
add_action( 'template_redirect', function() { | |
if ( wcfm_is_store_page() ) { | |
$wcfm_store_url = get_option( 'wcfm_store_url', 'store' ); | |
$store_name = apply_filters( 'wcfmmp_store_query_var', get_query_var( $wcfm_store_url ) ); | |
$store_id = 0; | |
if(!empty($store_name)) { | |
$store_user = get_user_by( 'slug', $store_name ); | |
$store_id = $store_user->ID; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
add_filter( 'wcfm_marketplace_settings_fields_general', function( $setting_fields, $vendor_id ) { | |
if( isset($setting_fields['store_name']) ) { | |
$website_url = get_user_meta( $vendor_id, '_wcfm_vendor_website_url', true ); | |
$vendor_website_url = array( | |
"_wcfm_vendor_website_url" => array( 'label' => __( 'Website URL', 'wc-frontend-manager' ), 'type' => 'text', 'class' => 'wcfm-text wcfm_ele', 'label_class' => 'wcfm_title wcfm_ele', 'value' => esc_url($website_url) ), | |
); | |
$setting_fields = array_merge( $setting_fields, $vendor_website_url ); | |
} | |
return $setting_fields; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
add_action('wcfm_vendor_groups_actions', function($actions, $wcfm_groups_single) { | |
$actions .= '<a class="wcfm_group_duplicate wcfm-action-icon" href="#" data-groupid="' . $wcfm_groups_single->ID . '"><span class="wcfmfa fa-copy text_tip" data-tip="' . esc_attr__( 'Duplicate', 'wc-frontend-manager' ) . '"></span></a>'; | |
return $actions; | |
}, 10, 2); | |
add_action('after_wcfm_groups', function() { | |
?> | |
<script> | |
jQuery(function($) { | |
$('#wcfm-groups').on('click', '.wcfm_group_duplicate', function(){ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
add_action( 'woocommerce_cart_loaded_from_session', function() { | |
$products_in_cart = array(); | |
foreach ( WC()->cart->cart_contents as $key => $item ) { | |
$_product = apply_filters( 'woocommerce_cart_item_product', $item['data'], $item, $key ); | |
$vendor_id = wcfm_get_vendor_id_by_post( $_product->get_id() ); | |
$products_in_cart[ $key ] = wcfm_get_vendor_store_name( $vendor_id )."-".$item['data']->get_title(); | |
} | |
natcasesort( $products_in_cart ); | |
$cart_contents = array(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
use Stripe\Stripe as Stripe; | |
use Stripe\Account as Stripe_Account; | |
add_action('wcfm_vendor_end_settings_payment', function($user_id) { | |
$user_settings = get_user_meta( $user_id, 'wcfmmp_profile_settings', true ); | |
$vendor_connected = get_user_meta( $user_id, 'vendor_connected', true ); | |
$stripe_user_id = get_user_meta($user_id, 'stripe_user_id', true); | |
if ( isset( $user_settings['payment']['method'] ) && $user_settings['payment']['method'] === 'stripe' && $vendor_connected == 1 && $stripe_user_id && apply_filters( 'wcfm_is_allow_stripe_express_api', true ) ) { | |
try { | |
$login_temp_link = Stripe_Account::createLoginLink( $stripe_user_id ); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
add_filter( 'woocommerce_is_purchasable', function($is_purchasable, $product) { | |
if ( method_exists( $product, 'get_id' ) ) { | |
$product_id = $product->get_id(); | |
if ( $product_id ) { | |
$vendor_id = wcfm_get_vendor_id_by_post($product_id); | |
if($vendor_id) { | |
$vendor_data = get_user_meta( $vendor_id, 'wcfmmp_profile_settings', true ); | |
$payment_mode = isset( $vendor_data['payment']['method'] ) ? esc_attr( $vendor_data['payment']['method'] ) : '' ; | |
$stripe_user_id = get_user_meta( $vendor_id, 'stripe_user_id', true ); |
NewerOlder