add_action(‘admin_init’, ‘restrict_product_creation’); function restrict_product_creation() { $product_count = wp_count_posts(‘product’)->publish; if ($product_count >= 10) { add_action(‘admin_footer’, function() { echo ‘ ‘; }); add_filter(‘wp_insert_post_data’, function($data, $postarr) { if ($data[‘post_type’] === ‘product’ && $data[‘post_status’] !== ‘trash’) { wp_die(‘You have reached the maximum limit of…Continue reading
add_filter( ‘the_content’, function ( $content ) { // Return early if it isn’t the home page or the blog page. if ( ! is_home() && ! is_front_page() ) { return $content; } return str_replace( ‘Continue reading
/** * Allow login with email only.. By Amiru アミル さん */ // 1. Authenticate user by email if username is not provided. add_filter(‘authenticate’, ‘authenticate_with_email’, 20, 3); function authenticate_with_email($user, $username, $password) { if (empty($username) && !empty($password)) { // Check if…Continue reading
function bulk_update_shipping_zones_vayots_dzor() { global $wpdb; // Define the shipping zones and their corresponding state codes $zones = array( ‘Ագարակաձոր’ => [‘code’ => ‘AG1’, ‘price’ => 9600], ‘Ազատեկ’ => [‘code’ => ‘AR2’, ‘price’ => 11600], ‘Ախտա’ => [‘code’ => ‘AI3’, ‘price’…Continue reading
.payment-plans { margin-top: 20px; padding: 15px; background-color: #fff; border: 1px solid #ddd; border-radius: 8px; display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; } .payment-plans h3 { font-size: 20px; font-weight: bold; margin-bottom: 10px; color: #333; width: 100%; text-align: center; } .payment-plan…Continue reading
// Register a shortcode to display payment plans with minimalistic design add_shortcode(‘pedro_payment_plans’, ‘pedro_display_payment_plans’); function pedro_display_payment_plans() { // Get the global product object global $product; // Ensure $product is valid if (!$product || !is_a($product, ‘WC_Product’)) { return ”; // Return nothing…Continue reading
function custom_override_woocommerce_states( $states ) { // Override ‘AO’ states Արարատ. $states[‘AO’] = array( ‘AO1’ => __( ‘Ագարակ’, ‘woocommerce’ ), ‘AO2’ => __( ‘Ագարակավան’, ‘woocommerce’ ), ‘AO3’ => __( ‘Ալագյազ’, ‘woocommerce’ ), ‘AO4’ => __( ‘Ակունք’, ‘woocommerce’ ), ‘AO5’ => __(…Continue reading
add_filter( ‘woocommerce_countries’, ‘modify_woocommerce_country_names’ ); function modify_woocommerce_country_names( $countries ) { // List of country codes to keep $allowed_countries = array( ‘ER’, ‘AO’, ‘DZ’, ‘AU’, ‘BD’, ‘BG’, ‘BJ’, ‘BO’, ‘BR’, ‘CA’, ‘CH’ ); // Loop through all countries and remove the ones…Continue reading
// CHANGE this array – should be a comma separated list of Membership ID’s to apply the signup codes to $GLOBALS[‘free_memberships_require_coupon’] = array(123); function make_coupon_mandatory_free_membership($errors) { if(!isset($_POST[‘mepr_coupon_code’]) || trim($_POST[‘mepr_coupon_code’]) == ” && in_array($_POST[‘mepr_product_id’], $GLOBALS[‘free_memberships_require_coupon’])) { $errors[] = ‘A valid coupon…Continue reading