This file contains hidden or 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
/* | |
* Adding extra field on New product popup/without popup form | |
*/ | |
add_action( 'dokan_new_product_after_product_tags','new_product_field',10 ); | |
function new_product_field(){ ?> | |
<div class="dokan-form-group"> |
This file contains hidden or 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 | |
/** | |
* Exclude admin roles from vendor query | |
* | |
* @param $seller_args | |
* @return mixed | |
*/ | |
function exclude_some_sellers_users( $seller_args ) { | |
$seller_args['role__in'] = array( 'seller' ); // add here roles | |
return $seller_args; |
This file contains hidden or 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
/** | |
* Validation add for product cover image | |
* | |
* @param array $errors | |
* @return array $errors | |
*/ | |
function dokan_can_add_product_validation_customized( $errors ) { | |
$postdata = wp_unslash( $_POST ); | |
$featured_image = absint( sanitize_text_field( $postdata['feat_image_id'] ) ); | |
$_regular_price = absint( sanitize_text_field( $postdata['_regular_price'] ) ); |
This file contains hidden or 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
function dokan_can_edit_product_shipping_filed_validation( $errors ) { | |
if ( stripslashes( isset( $_POST['_disable_shipping'] ) ) && 'yes' == $_POST['_disable_shipping'] ) { | |
$errors[] = __( 'Please select shipping option', 'dokan-lite' ); | |
} | |
if ( $_POST['product_shipping_class'] < 1 ) { | |
$errors[] = __( 'Please select shipping class', 'dokan-lite' ); | |
} | |
return $errors; | |
} | |
add_filter( 'dokan_can_edit_product', 'dokan_can_edit_product_shipping_filed_validation', 35, 1 ); |
This file contains hidden or 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('woocommerce_product_tabs','remove_wc_tab',12); | |
function remove_wc_tab($tabs){ | |
unset($tabs['reviews']); //removing review tab | |
unset($tabs['additional_information']); //removing additional info tab | |
return $tabs; | |
} |
This file contains hidden or 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
You may need to do custom code to show your custom order status on the frontend in both order list and order details.php. | |
When you will add new order Status for WooCommerce you need to use the same filter to ADD NEW CASE to show and save the | |
order status when someone updates the order and to send order status changes through order-notes on the frontend. | |
Kindly use the below hooks to get it done. | |
dokan_get_order_status_translated & dokan_get_order_status_class | |
Kindly open dokan-lite/templates/orders/listing.php and check this filter- dokan_bulk_order_statuses which should help you. |
This file contains hidden or 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
//showing avatar on my-account page | |
function showing_custom_avatar(){ | |
$current_user = wp_get_current_user(); | |
echo'<div class="myaccount_custom">'.get_avatar($current_user->user_email,72,'',$current_user->display_name). '</div>'; | |
} |
This file contains hidden or 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
/* Store notice field seller settings */ | |
add_filter( 'dokan_settings_form_bottom', 'extra_fields', 10, 2); | |
function extra_fields( $current_user, $profile_info ){ | |
$booth_news= get_user_meta( $current_user, 'booth_news', true ); | |
?> | |
<div class="gregcustom dokan-form-group"> | |
<label class="dokan-w3 dokan-control-label" for="setting_address"> | |
<?php _e( 'Store Notice', 'dokan' ); ?> | |
</label> |
This file contains hidden or 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
/** | |
* Hide shipping rates when free shipping is available. | |
* | |
* @param array $rates Array of rates found for the package. | |
* @return array | |
*/ | |
function dokan_vendor_shipping_hide_when_free_is_available( $rates ) { | |
$free = array(); | |
foreach ( $rates as $rate_id => $rate ) { |
This file contains hidden or 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 | |
function dokan_store_listing_orderby_ramdom_filter( $seller_args ) { | |
$seller_args['orderby'] = 'dokan_store_rand'; | |
return $seller_args; | |
} | |
add_filter( 'dokan_seller_listing_args', 'dokan_store_listing_orderby_ramdom_filter', 99 ); | |
function dokan_store_listing_orderby_filter_query( $query ) { | |
if ( $query->query_vars['orderby'] === 'dokan_store_rand' ) { | |
$order_by = [ |