WooCommerce Tips

Replace WooCommerce category images with plain text.

Sometimes itโ€™s a pain to make images for all your WooCommerce product categories. Otherwise, you get the ugly default image. For example, see the image below where each category displays text only with a blue background. Add the CSS below to hide the category image and style how you want the category names appear. li.product-category a { padding-top:15px; padding-bottom:15px; }…

Read More

Make the default Divi search box search WooCommerce products only

If you have a Divi/WooCommerce site and you donโ€™t have any posts, this is perfect for you. The default Divi search will now search only your products. You can add this to the Divi theme options Integration tab in the head. Or add to a Code module in your global header. This also changes the placeholder text from โ€œSearchโ€ to โ€œSearch Productsโ€. For example when you click on the search icon like…

Read More

Change the default U.S. state in the dropdown on WooCommerce checkout page

Add the following PHP code to your child theme functions.php file. //default checkout US state dropdown blank instead of the default site state making taxes sometimes show up add_filter( ‘default_checkout_billing_state’, ‘change_default_checkout_state’ ); add_filter( ‘default_checkout_shipping_state’, ‘change_default_checkout_state’ ); function change_default_checkout_state() { return ”; //set…

Read More

How to Change In Stock text in WooCommerce

Add the following PHP code to your child theme functions.php file. /* Change In Stock text in WooCommerce */ add_filter( ‘woocommerce_get_availability’, ‘wcs_custom_get_availability’, 1, 2); function wcs_custom_get_availability( $availability, $_product ) { // Change In Stock Text if ( $_product->is_in_stock() ) { $availability[’availability’] = __(‘Available!’, ‘woocommerce’); }…

Read More

Move email form to top of WooCommerce checkout page

Add the following PHP code to your child theme functions.php file. /* Move email form to top of Woocommerce checkout page */ add_filter( ‘woocommerce_billing_fields’, ‘custom_woo_move_checkout_email_field’, 10, 1 ); function custom_woo_move_checkout_email_field( $address_fields ) { $address_fields[’billing_email’][’priority’] = 5; return $address_fields; }

Read More

Hide Coupon Code Area on WooCommerce Cart Page

Add the following PHP code to your child theme functions.php file. // hide coupon field on the cart page function disable_coupon_field_on_cart( $enabled ) { if ( is_cart() ) { $enabled = false; } return $enabled; } add_filter( ‘woocommerce_coupons_enabled’, ‘disable_coupon_field_on_cart’ );

Read More

Show Product Thumbnail on WooCommerce Checkout Page

Add the following PHP code to your child theme functions.php file. /** * Show product thumbnail on checkout page. * * @see {templates|woocommerce}/checkout/review-order.php */ add_filter( ‘woocommerce_cart_item_name’, ‘jfs_checkout_show_product_thumbnail’, 10, 2 ); function jfs_checkout_show_product_thumbnail( $name, $cart_item ) { if ( ! is_checkout() ) return $name; $thumbnail = ‘<span…

Read More

How to delay WooCommerce Emails

You may find this helps speed up the checkout process by delaying the WooCommerce order emails from sending immediately at checkout. Add the following PHP code to your child theme functions.php file. // delay woocommerce emails add_filter( ‘woocommerce_defer_transactional_emails’, ‘__return_true’ );

Read More

eCommerce with WooCommerce and WordPress – What you need to know

Here are some thoughts, ideas and tips that may help you on the way to building your own eCommerce website with WooCommerce and WordPress. What does it cost? I guess it comes down to the level of game you want to play. If you want to do things on the cheap, then expect to get a similar ROI. When I say cheap, Iโ€™m talking about $1,000 or less. If you cannot budget at least $2,000 to build an…

Read More

How to customize WooCommerce messages on cart and checkout pages

Add the following CSS in the Divi theme options area and customize however you like. .woocommerce-error, .woocommerce .woocommerce-error, .woocommerce-info, .woocommerce .woocommerce-info, .woocommerce-message, .woocommerce .woocommerce-message { padding: 1em 2em 1em 3.5em !important; margin: 0 0 2em !important; position: relative !important; background-color: #f7f6f7 !important; background:…

Read More

How to change “Create an account” text in WooCommerce / WordPress

If you want to change the text that appears on things like the WooCommerce โ€œcreate an accountโ€. You can use the same code and replace the variable โ€œwoocommerceโ€ for other items. Try the simple code below and it may work for you. Add the function below to your child theme functions.php file. // change text from Create an account? function my_text_strings( $translated_text, $text, $domain ) {…

Read More

How to change the word “Sale” on the WooCommerce sale badge

Add the function below to your child theme functions.php file. // change Sale to Save on the sale badge add_filter( โ€˜woocommerce_sale_flashโ€™, โ€˜wc_custom_replace_sale_textโ€™ ); function wc_custom_replace_sale_text( $html ) { return str_replace( __( โ€˜Sale!โ€™, โ€˜woocommerceโ€™ ), __( โ€˜Save!โ€™, โ€˜woocommerceโ€™ ), $html ); }

Read More

How to replace Howdy message in WordPress

Iโ€™m guessing someone in Texas had something to do with the word โ€œHowdyโ€ being the welcome prefix in WordPress. Itโ€™s easy enough to change. Add the function below to your child theme functions.php file. /* replacing Howdy with Hello */ function howdy_message($translated_text, $text, $domain) { $new_message = str_replace(โ€˜Howdyโ€™, โ€˜Helloโ€™, $text); return $new_message; } add_filter(โ€˜gettextโ€™,…

Read More

How to add search fields to WooCommerce orders page

You may find it useful to have additional search fields in the WooCommerce orders page in the WP admin area. Add the function below to your child theme functions.php file. /* add search fields to woocommerce orders page Allowed search fields: _order_key _billing_first_name _billing_last_name _billing_company _billing_address_1 _billing_city _billing_postcode _billing_country _billing_state…

Read More

How to prevent hidden WooCommerce products from showing up in WordPress search results

Add the function below to your child theme functions.php file. /* Preventing Hidden WooCommerce products from showing up in WordPress search results */ if ( ! function_exists( โ€˜gamma_search_query_fixโ€™ ) ){ function gamma_search_query_fix( $query = false ) { if(!is_admin() && is_search()){ $query->set( โ€˜meta_queryโ€™, array( โ€˜relationโ€™ => โ€˜ORโ€™, array( โ€˜keyโ€™ => โ€˜_visibilityโ€™, โ€˜valueโ€™ =>…

Read More

How to move WooCommerce category description to bottom of page

For SEO reasons you should have good text on your WooCommerce category pages. But, you may want to display your products first. Add the function below to your child theme functions.php file. // move category description to bottom of pages remove_action( ‘woocommerce_archive_description’, ‘woocommerce_taxonomy_archive_description’, 10 ); add_action( ‘woocommerce_after_shop_loop’,…

Read More

How to add Order Again button to WooCommerce My Account / Previous Orders page

Add the function below to your child theme functions.php file. /** * Add order again button in my orders actions. * * @param array $actions * @param WC_Order $order * @return array */ function cs_add_order_again_to_my_orders_actions( $actions, $order ) { if ( $order->has_status( โ€˜completedโ€™ ) ) { $actions[โ€˜order-againโ€™] = array( โ€˜urlโ€™ => wp_nonce_url( add_query_arg( โ€˜order_againโ€™, $order->id…

Read More

How to add alt tags to WooCommerce product images

Add the function below to your child theme functions.php file. // adding alt tags to product images add_filter(โ€˜wp_get_attachment_image_attributesโ€™, โ€˜change_attachement_image_attributesโ€™, 20, 2); function change_attachement_image_attributes( $attr, $attachment ){ // Get post parent $parent = get_post_field( โ€˜post_parentโ€™, $attachment); // Get post type to check if itโ€™s product $type =…

Read More

How to update WooCommerce order status to processing when an order is placed using PayPal

How to update WooCommerce order status to processing when an order is placed using PayPal. Add the following PHP code to your child theme functions.php file. function update_wc_order_status($posted) { $order_id = isset($posted[’invoice’]) ? $posted[’invoice’] : ”; if(!empty($order_id)) { $order = new WC_Order($order_id); $order->update_status(‘processing’); } }…

Read More

How to change the “Proceed to PayPal” button text on the WooCommerce checkout screen

The default PayPal buttons says โ€œProceed to PayPalโ€. You may want to change this to something else like โ€œContinue to Payโ€ or whatever you like. Add the following PHP code to your child theme functions.php file. add_filter( ‘gettext’, ‘custom_paypal_button_text’, 20, 3 ); function custom_paypal_button_text( $translated_text, $text, $domain ) { switch ( $translated_text ) { case ‘Proceed to…

Read More

More Tips

Ask a Question

Tell me about your project. The more details the better.

"*" indicates required fields