// WC – limit one course at a time (id 50697 / Fundamentals Public Safety) add_filter( ‘woocommerce_add_to_cart_validation’, ‘wc_limit_one_50697_per_order’, 10, 2 ); function wc_limit_one_50697_per_order( $passed_validation, $product_id ) { if ( 50697 !== $product_id ) { return $passed_validation; } if ( WC()->cart->get_cart_contents_count()…Continue reading
// add order suffix add_filter(‘woe_get_order_value_order_number’, ‘suffix_order_id_for_product_50697’, 10, 2 ); function suffix_order_id_for_product_50697( $order_id, $order ) { // Check if the order contains the specified product $product_id_to_check = 50697; $order_contains_product = false; foreach ( $order->get_items() as $item_id => $item ) { if…Continue reading
// add order suffix add_filter(‘woe_get_order_value_order_number’, ‘suffix_order_id_for_product_45639’, 10, 2 ); function suffix_order_id_for_product_45639( $order_id, $order ) { // Check if the order contains the specified product $product_id_to_check = 45639; $order_contains_product = false; foreach ( $order->get_items() as $item_id => $item ) { if…Continue reading
// WC – avoid other items to be added to cart when a specific product category (free courses) is already in cart add_filter( ‘woocommerce_add_to_cart_validation’, ‘check_and_limit_cart_free_items’, 10, 3 ); function check_and_limit_cart_free_items ( $passed, $product_id, $quantity ){ // HERE set your product…Continue reading
/** * Change Membership Level on Cancellation or Expiration * * Change the Level ID on line 30 to the level you want members to have assigned * to them after cancellation or expiration. * * title: Change Membership Level…Continue reading
/** * Filter the settings of email frequency sent when using the Extra Expiration Warning Emails Add On * https://www.paidmembershipspro.com/add-ons/extra-expiration-warning-emails-add-on/ * * Update the $settings array to your list of number of days => ”. * Read the Add On…Continue reading
/** * Add inline label and button styling to Paid Memberships Pro checkout page. */ function my_load_inline_labels_checkout() { global $pmpro_pages; if ( ! is_page( $pmpro_pages[‘checkout’] ) ) { return; } ?>Continue reading
function disable_administrator_role_checkbox() { $current_user = wp_get_current_user(); $current_user_roles = (array) $current_user->roles; // Check if the current user is an administrator if (in_array(‘administrator’, $current_user_roles)) { ?>Continue reading
// Add custom submenu page for restricted name change users function add_restricted_name_change_users_submenu_page() { add_submenu_page( ‘users.php’, // parent slug __(‘Restricted Name Change Users’), // page title __(‘Restricted Name Change Users’), // menu title ‘manage_options’, // capability ‘restricted_name_change_users’, // menu slug ‘display_restricted_name_change_users’…Continue reading
function remove_color_scheme_options() { remove_action(‘admin_color_scheme_picker’, ‘admin_color_scheme_picker’); } add_action(‘admin_init’, ‘remove_color_scheme_options’);Continue reading