Skip to content

Instantly share code, notes, and snippets.

View arfinmilondev's full-sized avatar
🎯
Focusing

R A Milon arfinmilondev

🎯
Focusing
View GitHub Profile
KFZUS-F3JGV-T95Y7-BXGAS-5NHHP
T3ZWQ-P2738-3FJWS-YE7HT-6NA3K
KFZUS-F3JGV-T95Y7-BXGAS-5NHHP
65Z2L-P36BY-YWJYC-TMJZL-YDZ2S
SFZHH-2Y246-Z483L-EU92B-LNYUA
GSZVS-5W4WA-T9F2E-L3XUX-68473
FTZ8A-R3CP8-AVHYW-KKRMQ-SYDLS
Q3ZWN-QWLZG-32G22-SCJXZ-9B5S4
DAZPH-G39D3-R4QY7-9PVAY-VQ6BU
KLZ5G-X37YY-65ZYN-EUSV7-WPPBS
@arfinmilondev
arfinmilondev / custom_edd_login_redirect.php
Created July 1, 2025 05:46
Redirect affiliate users to the Affiliate area page when login through EDD Login form
<?php
//if the user is an affiliate. Based on that, you can redirect them either to the Affiliate Area or the EDD Customer Dashboard.
if ( ! function_exists( 'custom_edd_login_redirect' ) ) {
function custom_edd_login_redirect( $redirect_to, $user_id ) {
if ( function_exists( 'affwp_is_affiliate' ) && affwp_is_affiliate( $user_id ) ) {
return site_url( '/affiliate-area/' );
}
return $redirect_to;
}
@arfinmilondev
arfinmilondev / deleteCustomers.sql
Last active May 29, 2025 06:20
Remove user which has customer user role from database SQL code
DELETE u, um
FROM wp_users u
LEFT JOIN wp_usermeta um ON um.user_id = u.ID
WHERE u.ID IN (
SELECT user_id
FROM (
SELECT user_id
FROM wp_usermeta
WHERE meta_key = 'wp_capabilities'
AND meta_value LIKE '%customer%'
@arfinmilondev
arfinmilondev / add_to_cart_button_text.php
Created May 19, 2025 09:28
Change woocommerce add to cart text
<?php
/**
-----------------------------------------------------------------------------
Change woocommerce add to cart text
-----------------------------------------------------------------------------
*/
add_filter( 'woocommerce_product_single_add_to_cart_text' , 'woo_custom_cart_button_text' );
@arfinmilondev
arfinmilondev / woocommerce_ajax_variation_threshold.php
Created May 5, 2025 06:54
Increase the default number limit of variations for a product in WooCommerce
<?php
add_filter( 'woocommerce_ajax_variation_threshold', function(){
return 100;
});
// Add this code to your function.php file
add_filter( 'woocommerce_ajax_variation_threshold', function( $quantity, $product ) {
return 50;
@arfinmilondev
arfinmilondev / NewCustomField.php
Created March 26, 2025 05:07
Add New Custom Field in Woo Commerce Checkout Fields
<?php
// Add New Custom Field
add_action( 'woocommerce_before_order_notes', 'wtwh_add_custom_checkout_field' );
function wtwh_add_custom_checkout_field( $checkout ) {
$current_user = wp_get_current_user();
$saved_car_no = $current_user->car_no;
woocommerce_form_field( 'car_no', array(
'type' => 'text',
'class' => array( 'form-row-wide' ),
@arfinmilondev
arfinmilondev / reset_permalinks.php
Created March 23, 2025 06:23
Set permalink to post after theme activated in WordPress
@arfinmilondev
arfinmilondev / woocommerce_currency_symbol.php
Created March 19, 2025 07:03
woocommerce change currency symbol
//change currency symbol
add_filter('woocommerce_currency_symbol', 'milon_change_currency_symbol', 10, 2);
function milon_change_currency_symbol( $currency_symbol, $currency ) {
switch( $currency ) {
case 'KWD': $currency_symbol = 'KD'; break;
}
return $currency_symbol;
}
@arfinmilondev
arfinmilondev / ocdi_elementor_kit_import.php
Created March 8, 2025 08:14
Import Elementor kit data in OCDI
/**
* Function to perform setup after importing data.
* This function assigns the front page and the posts page (blog page) based on the imported demo.
* @param array $selected_import The selected import data.
* @link https://www.codeixer.com/addressing-the-issue-of-one-click-demo-import-not-add-elementor-global-options/
*/
function cdx_after_import_setup( $selected_import ) {
// Import Elementor kit data.
$cdx_kit_zip = get_parent_theme_file_path() . '/demo-content/elementor-kit.zip';
@arfinmilondev
arfinmilondev / feature_icon_type.php
Created August 7, 2024 06:23
Access array offset on value of null Issue Fixing
<?php
$feature_image = '';
if (($settings['feature_icon_type'] ?? '') == 'img') {
$feature_image = Group_Control_Image_Size::get_attachment_image_html($settings, 'feature_imagesize', 'feature_image');
}
$html_output = '';
$html_output .= '<div ' . $this->get_render_attribute_string('growth_feature_attr') . ' >';
if (!empty($feature_image)) {
$html_output .= '<div class="feature-icon">' . $feature_image . '</div>';