Skip to content

Instantly share code, notes, and snippets.

View alamgircsebd's full-sized avatar

Alamgir Hossain alamgircsebd

View GitHub Profile
@alamgircsebd
alamgircsebd / dokan-free-shipping-hide.php
Created February 2, 2021 03:43
Hide shipping rates when free shipping is available
/**
* 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 ) {
if ( 'free_shipping' === $rate->method_id || 'free_shipping' === $rate->id || strpos( $rate->id, 'free_shipping' ) !== false ) {
/**
* Dokan missing geolocation data migrate for products
*
* @param Int $store_id
*/
function dokan_missing_geolocation_data_migrate( $store_id = 0 ) {
if ( empty( $store_id ) ) {
return;
}
if ( ! class_exists( 'WeDevs_Dokan' ) ) {
@alamgircsebd
alamgircsebd / dokan_thank_you_order_received_text_modified
Last active December 9, 2021 23:10
Thank you message modified to vendor info on order received page
// How Use => Add this scripts on your theme functions.php file
// Output => https://prnt.sc/y4ljek
/**
* Thank you message modified to vendor info on order received page
*
* @param string $thank_you_title
* @param obj $order
@alamgircsebd
alamgircsebd / gist:93cf78b50623c4f9f52b3dfd1b2d696c
Created March 29, 2021 09:32
Default filter option open on dokan store listing page
/**
* Default filter option open on dokan store listing page
*
* Use this code on main/child theme functions.php file
* or use custom plugin for add scripts on footer area
*/
function add_custom_scripts_for_store_listing_page_on_footer() {
if ( function_exists( 'dokan_is_store_listing' ) && dokan_is_store_listing() ) {
?>
<script>
@alamgircsebd
alamgircsebd / gist:5efc2dadaed4e3134bcf1785488899d9
Created March 29, 2021 12:40
Vendor category box hide by click out of box on dokan store listing page
/**
* Vendor category box hide by click outofbox on dokan store listing page
*
* Use this code on main/child theme functions.php file
* or use custom plugin for add scripts on footer area
*/
function add_custom_scripts_for_store_listing_dokan_category_on_footer() {
if ( function_exists( 'dokan_is_store_listing' ) && dokan_is_store_listing() ) {
?>
<script>
@alamgircsebd
alamgircsebd / gist:86a91023b1bac81f03934d1649d8f102
Created March 31, 2021 06:52
Remove external product type for dokan vendors
/**
* Remove external product type for dokan vendors
*
* @param array $types
*
* @return array $types
*/
function dokan_get_product_types_remove_external_type( $types ) {
unset( $types['external'] );
@alamgircsebd
alamgircsebd / currency switcher support
Last active April 5, 2021 07:29
Currency switcher support
/**
* Add this codes on your parent/child theme functions.php or use custom plugin for add php scripts
*/
if ( ! function_exists( 'dokan_woocs_recalculate_order_payment_completed' ) ) {
/**
* Recalculate order for wc currency switcher support
*
* @param int $order_id
*
@alamgircsebd
alamgircsebd / gist:2466f7fc7a5f0b70ebf60a4ba2cf8342
Created April 9, 2021 08:58
Disabled refund emails for dokan sub order
/**
* Disabled refund emails for dokan sub order
*
* @param string $recipient
* @param string $order
*
* @return mix
*/
@alamgircsebd
alamgircsebd / gist:0049ac314267abfb6317c93c88667477
Last active April 20, 2021 12:09
Dokan add new custom withdraw methods
/**
* Dokan add new withdraw method
*
* @param array $methods
*
* @return array $methods
*/
function dokan_add_new_withdraw_method( $methods ) {
$methods['custom'] = [
'title' => __( 'Custom', 'dokan-lite' ),
@alamgircsebd
alamgircsebd / gist:cd9464c425228edfa525e46880465c43
Created May 30, 2021 16:17
Removed dokan shipping tab from single product page
/**
* Removed dokan shipping tab from single product page
*
* @param array $tabs
*/
function remove_dokan_registered_product_shipping_tab( $tabs ) {
unset( $tabs['shipping'] );
return $tabs;
}