Skip to content

Instantly share code, notes, and snippets.

View nayemDevs's full-sized avatar

Md. Nazmul Hassan nayemDevs

View GitHub Profile
@nayemDevs
nayemDevs / functions.php
Last active January 29, 2024 08:39
Creating a shortcode to show vendor biography anywhere on your page
<?php
/**
* Plugin Name: Dokan Vendor Biography Shortcode
*/
add_shortcode( 'dokan_vendor_bio', 'dokan_vendor_bio_shortcode' );
function dokan_vendor_bio_shortcode() {
$vendor = dokan()->vendor->get( get_query_var( 'author' ) );
$store_info = $vendor->get_shop_info();
if ( empty( $store_info['vendor_biography'] ) ) {
return;
@nayemDevs
nayemDevs / functions.php
Last active February 15, 2022 14:11
deleting product image when deleting a product in Dokan
<?php
add_action( 'before_delete_post', function( $id ) {
$product = wc_get_product( $id );
if ( ! $product ) {
return;
}
$all_product_ids = [];
$product_thum_id_holder = [];
$gallery_image_id_holder = [];
@nayemDevs
nayemDevs / functions.php
Last active April 11, 2023 19:16
re-order tab on single product page
add_filter( 'woocommerce_product_tabs', 'woo_reorder_tabs', 98 );
function woo_reorder_tabs( $tabs ) {
$tabs['reviews']['priority'] = 5; // Reviews first
$tabs['description']['priority'] = 10; // Description second
$tabs['additional_information']['priority'] = 15; // Additional information third
return $tabs;
}
@nayemDevs
nayemDevs / functions.php
Last active September 14, 2019 08:41
Show store name on single product page
/*Show store name on single product*/
add_action( 'woocommerce_single_product_summary', 'seller_name_on_single', 12 );
function seller_name_on_single(){
global $product;
$seller = get_post_field( 'post_author', $product->get_id());
$author = get_user_by( 'id', $seller );
$vendor = dokan()->vendor->get( $seller );
$store_info = dokan_get_store_info( $author->ID );
@nayemDevs
nayemDevs / functions.php
Last active April 26, 2022 16:11
Show Store name on product thumbnail instead of vendor name
<?php
/*
Show Store name on the product thumbnail For Dokan Multivendor plugin
*/
add_action( 'woocommerce_after_shop_loop_item_title','sold_by' );
function sold_by(){
?>
</a>
@nayemDevs
nayemDevs / functions.php
Last active April 11, 2023 19:19
Change Bank withdraw method fields in vendor dashboard settings in Dokan
<?php
/*
You can change any field title or remove any feild for the vendor -> settings -> payment -> bank transfer method. Please note that this
code need to be placed on your child-theme functions.php file
*/
add_filter( 'dokan_withdraw_methods', 'wp1923_change_whithdraw_callback', 12 );
function wp1923_change_whithdraw_callback( $methods ) {
@nayemDevs
nayemDevs / functions.php
Last active August 29, 2023 08:29
Override seller setup-wizard via child-theme using Class
<?php
class Dokan_Setup_Wizard_Override extends Dokan_Seller_Setup_Wizard {
/**
* Introduction step.
*/
public function dokan_setup_introduction() {
$dashboard_url = dokan_get_navigation_url();
@nayemDevs
nayemDevs / functions.php
Last active January 31, 2019 20:18
icon missing
<?php
/*
- Missing icon fixing
- fontawesome v5
- Use the code from line number 7 to 12 on your child-theme functions.php
*/
add_filter ('dokan_get_dashboard_nav','change_icon',16);
function change_icon($urls){
$urls['reviews']['icon'] = '<i class="fas fa-comments"></i>';
$urls['reports']['icon'] = '<i class="fas fa-chart-line"></i>';
@nayemDevs
nayemDevs / functions.php
Last active September 14, 2019 08:40
adding sold by option on the single product page
add_action( 'woocommerce_single_product_summary', 'seller_name_on_single', 11 );
function seller_name_on_single(){
global $product;
$seller = get_post_field( 'post_author', $product->get_id());
$author = get_user_by( 'id', $seller );
$store_info = dokan_get_store_info( $author->ID );
if ( !empty( $store_info['store_name'] ) ) { ?>
<span class="details">
@nayemDevs
nayemDevs / help.php
Created October 11, 2017 04:10
Template file for the dashboard menu
<?php
/**
* Dokan Dashboard Template
*
* Dokan Main Dahsboard template for Fron-end
*
* @since 2.4
*
* @package dokan
*/