Hide Products Count in Category View
function g9_remove_category_products_count() { return; } add_filter(‘woocommerce_subcategory_count_html’, ‘g9_remove_category_products_count’);Continue reading
Join 2,000,000+ Professionals who use WPCode to Future-Proof Their Websites!
function g9_remove_category_products_count() { return; } add_filter(‘woocommerce_subcategory_count_html’, ‘g9_remove_category_products_count’);Continue reading
function g9_remove_woocommerce_checkout_fields($fields) { // Remove billing fields unset($fields[‘billing’][‘billing_first_name’]); unset($fields[‘billing’][‘billing_last_name’]); unset($fields[‘billing’][‘billing_company’]); unset($fields[‘billing’][‘billing_address_1’]); unset($fields[‘billing’][‘billing_address_2’]); unset($fields[‘billing’][‘billing_city’]); unset($fields[‘billing’][‘billing_postcode’]); unset($fields[‘billing’][‘billing_country’]); unset($fields[‘billing’][‘billing_state’]); unset($fields[‘billing’][‘billing_phone’]); unset($fields[‘billing’][‘billing_email’]); // Remove shipping fields unset($fields[‘shipping’][‘shipping_first_name’]); unset($fields[‘shipping’][‘shipping_last_name’]); unset($fields[‘shipping’][‘shipping_company’]); unset($fields[‘shipping’][‘shipping_address_1’]); unset($fields[‘shipping’][‘shipping_address_2’]); unset($fields[‘shipping’][‘shipping_city’]); unset($fields[‘shipping’][‘shipping_postcode’]); unset($fields[‘shipping’][‘shipping_country’]); unset($fields[‘shipping’][‘shipping_state’]); // Remove order comment fields unset($fields[‘order’][‘order_comments’]); return $fields; }…Continue reading
function g9_woocommerce_breadcrumb() { remove_action(‘woocommerce_before_main_content’, ‘woocommerce_breadcrumb’, 20, 0); } add_action(‘init’, ‘g9_woocommerce_breadcrumb’);Continue reading
function g9_limit_order_note_length($fields) { $fields[‘order’][‘order_comments’][‘maxlength’] = 200; return $fields; } add_filter(‘woocommerce_checkout_fields’, ‘g9_limit_order_note_length’);Continue reading
function g9_custom_excerpt_length($length) { return 20; } add_filter(‘excerpt_length’, ‘g9_custom_excerpt_length’);Continue reading
function g9_disable_emojis() { remove_action(‘wp_head’, ‘print_emoji_detection_script’, 7); remove_action(‘admin_print_scripts’, ‘print_emoji_detection_script’); remove_action(‘wp_print_styles’, ‘print_emoji_styles’); remove_action(‘admin_print_styles’, ‘print_emoji_styles’); remove_filter(‘the_content_feed’, ‘wp_staticize_emoji’); remove_filter(‘comment_text_rss’, ‘wp_staticize_emoji’); remove_filter(‘wp_mail’, ‘wp_staticize_emoji_for_email’); add_filter(‘tiny_mce_plugins’, ‘g9_disable_emojis_tinymce’); add_filter(‘wp_resource_hints’, ‘g9_disable_emoji_dns_prefetch’, 10, 2); } function g9_disable_emojis_tinymce($plugins) { if (is_array($plugins)) { return array_diff($plugins, array(‘wpemoji’)); } else { return array(); }…Continue reading
if (!function_exists(‘woocommerce_template_single_excerpt’)) { function woocommerce_template_single_excerpt($post) { global $post; if ($post->post_excerpt) echo ‘ ‘ . do_shortcode(wpautop(wptexturize($post->post_excerpt))) . ‘ ‘; } }Continue reading
// Change add to cart text on single product page function g9_woocommerce_add_to_cart_button_text_single() { return __(‘Add to Cart Button Text’, ‘woocommerce’); } add_filter(‘woocommerce_product_single_add_to_cart_text’, ‘g9_woocommerce_add_to_cart_button_text_single’); // Change add to cart text on product archives page function g9_woocommerce_add_to_cart_button_text_archives() { return __(‘Add to Cart…Continue reading
function g9_remove_product_content() { // If a product in the ‘Cookware’ category is being viewed… if (is_product() && has_term(‘Cookware’, ‘product_cat’)) { //… Remove the images remove_action(‘woocommerce_before_single_product_summary’, ‘woocommerce_show_product_images’, 20); // For a full list of what can be removed please see woocommerce-hooks.php…Continue reading
function g9_minimum_order_amount() { // Set this variable to specify a minimum order value $minimum = 50; if (WC()->cart->total < $minimum) { if (is_cart()) { wc_print_notice( sprintf( 'Your current order total is %s — you must have an order with a…Continue reading