Skip to content

Instantly share code, notes, and snippets.

View J-H-Mojumder's full-sized avatar
💻
Learning

Md Jahidul Hassan Mojumder J-H-Mojumder

💻
Learning
  • Dhaka, Bangladesh
View GitHub Profile
@J-H-Mojumder
J-H-Mojumder / functions.php
Last active August 8, 2021 06:09
Remove columns (Company name, First Name, Last Name, Email, Phone, IP) from the vendor's order export CSV
<? php
function dokan_order_export_headers($headers){
unset($headers['billing_company']);
unset($headers['billing_first_name']);
unset($headers['billing_last_name']);
unset($headers['billing_email']);
unset($headers['billing_phone']);
unset($headers['customer_ip']);
return $headers;
@J-H-Mojumder
J-H-Mojumder / functions.php
Created August 27, 2021 07:01
Hide specific payment gateways for specific vendors or products (subscription pack)
<? php
add_filter('woocommerce_available_payment_gateways', 'show_hide_cod', 10, 1);
function show_hide_cod($gateways) {
if ( is_page( 'checkout' ) || is_checkout() ){
//list of vendor id to exclude COD
$vendor_list = [2];
@J-H-Mojumder
J-H-Mojumder / functions.php
Last active June 8, 2022 16:01
Show the shipping method description for local pickup so that the vendor can show the address in the check out page
<? php
add_action( 'woocommerce_after_shipping_rate' , 'function_to_show_description_for_local_pickup' );
function function_to_show_description_for_local_pickup($method){
if( array_key_exists( "description" , $method->meta_data ) ){
if ( ( $method->id == "local_pickup:4") ){
echo "</br><strong> Address: </strong>".$method->meta_data['description'];
@J-H-Mojumder
J-H-Mojumder / functions.php
Created January 28, 2022 10:59
Use [dokan_vendor_dashbord] shortcode to show the "Go to Vendor Dashboard" button on any page you want when a vendor is logged in.
<?php
add_shortcode( 'dokan_vendor_dashbord', 'dokan_show_vendor_dashboard_url' );
function dokan_show_vendor_dashboard_url() {
if ( ! dokan_is_user_seller( get_current_user_id() ) ) {
return;
}
printf(
'<p><a href="%s" class="dokan-btn dokan-btn-theme vendor-dashboard" >%s</a></p>',
@J-H-Mojumder
J-H-Mojumder / functions.php
Created April 24, 2022 06:49
Adding email address of the vendor under the vendor name in Dokan (https://snipboard.io/G9FSBz.jpg)
<?php
//Add vendor email alongside the vendor name
function add_email_in_cart( $item_data, $cart_item ){
$vendor = dokan_get_vendor_by_product( $cart_item['product_id'] );
if ( ! $vendor || ! $vendor->get_id() ) {
return $item_data;
}
@J-H-Mojumder
J-H-Mojumder / functions.php
Created May 13, 2022 03:37
Remove vendor info tab from the WooCommerce Single Product page
<?php
//Remove vendor info tab from the
add_filter( 'woocommerce_product_tabs', 'remove_vendor_info_tab' );
function remove_vendor_info_tab ($tabs){
unset($tabs['seller']);
return $tabs;
}
@J-H-Mojumder
J-H-Mojumder / functions.php
Created May 13, 2022 03:42
Show only one shipping fee in case of multivendor checkout
<?php
//Show only one shipping fee in case of multivendor checkout
remove_filter( 'woocommerce_cart_shipping_packages', 'dokan_custom_split_shipping_packages' );
remove_filter( 'woocommerce_shipping_package_name', 'dokan_change_shipping_pack_name');
remove_action( 'woocommerce_checkout_create_order_shipping_item', 'dokan_add_shipping_pack_meta');`
?>
@J-H-Mojumder
J-H-Mojumder / functions.php
Created May 13, 2022 03:52
Remove tabs from the single store page.
<?php
//You can use the below-mentioned code to remove any tab from the single store page of Dokan. Just keep the line of unset()
//that you need as per your requirement
add_filter( 'dokan_store_tabs', 'remove_product_tab', 14);
function remove_product_tab( $tabs) {
//unset($tabs['products']); //For removing the product tab
unset($tabs['terms_and_conditions']); //For removing the terms and conditions tab
@J-H-Mojumder
J-H-Mojumder / functions.php
Created May 13, 2022 03:54
Change column number of the single store page.
<?php
function single_store_page_product_columns( $columns ){
if( dokan_is_store_page() ){
return $columns = 4; //enter your desired number
} else {
return $columns;
}
}
add_filter( 'loop_shop_columns', 'single_store_page_product_columns', 99);
@J-H-Mojumder
J-H-Mojumder / functions.php
Created May 13, 2022 04:14
Add custom Shipping tracking provider
<?php
add_filter( 'dokan_shipping_status_tracking_providers_list', 'add_shipping_tracking_provider' );
function add_shipping_tracking_provider( $providers ){
$providers['sp-your-custom-name'] = array( //use a custom name instead of sp-your-custom-name as your wish
'label' => __( 'Your custom one', 'dokan' ), //This text will be shown in the backend and frontend
'url' => '',