Adding CSS styles into WooCommerce emails
WooCommerce emails can have CSS inline styles added via an action hook woocommerce_email_header, to add your CSS styles use the hook like below… add_action( ‘woocommerce_email_header’, ‘bt_add_css_to_email’ ); /** * WooCommerce * Add inline CSS to emails sent out */ function bt_add_css_to_email() { echo ‘ <style type=”text/css”> h1 { text-align: center !important; color: #c7c9c7; } </style></pre>…
Read MoreMake price in WooCommerce an absolute value
You can make the prices displayed in WooCommerce an absolute value and remove the decimal .00 places with the WooCommerce woocommerce_price_trim_zeros filter. So for example to go from $50.00 to $50 In your functions.php add the following… /** * WooCommerce * Trim zeros in price decimals **/ add_filter( ‘woocommerce_price_trim_zeros’, ‘__return_true’ );
Read MoreChange the WooCommerce return to shop and continue shopping URLs
You can change the WooCommerce shop URL with a filter that WooCommerce provides, this can be helpful especially if you have a one product based shop and you want your users to return to that product and not the default shop page URL. The filter to use is aptly named – woocommerce_return_to_shop_redirect – add in your…
Read MoreAdd Search & Filter Pro Filters In Off-Canvas Menu
Adding the Search & Filter Pro filters in an off-canvas menu can be a better user experience on mobile devices. This guide uses UABBs Off-Canvas Module with a WooCommerce main shop page built in Beaver Themer. With a desktop/tablet layout already in place, this example uses a 2-column layout, WooCommerce shop page on the right…
Read MoreSet up WooCommerce shop page with Search and Filter Pro and Beaver Themer
Here is how you can set up the main WooCommerce shop page with Search and Filter Pro and Beaver Themer. The layout is to have the filter options on the left and products on the right, the filtering is using the product categories as well as a custom taxonomy. Search & Filter Pro In…
Read MoreAdd WooCommerce Cart Icon to Menu with Cart Item Count
Here is a way to add WooCommerce cart icon to a menu with the cart item count, it links to the cart page and displays the number of items that have been added to the cart. The code uses three functions which need to be added to functions.php and some CSS in style.css. (If you just…
Read MoreChange WooCommerce Sold Out text
You can change WooCommerce ‘Sold Out’ text set by the inventory setting of Sold Out with the WooCommerce filter woocommerce_get_availability_text Add the below snippet with your custom sold text to functions.php add_filter(‘woocommerce_get_availability_text’, ‘themeprefix_change_soldout’, 10, 2 ); /** * Change Sold Out Text to Something Else */ function themeprefix_change_soldout ( $text, $product) { if ( !$product->is_in_stock()…
Read MoreUsing WooCommerce with Varnish, exclude pages and cookies
To use WooCommerce with Varnish server-side caching you need to exclude some of the generic WooCommerce pages and cookies. Some web hosts will partially do this for you and others will give you an interface to add them yourself, make sure you ask the host what options are available Exclude from Varnish these WooCommerce pages…
Read MoreFix Google Search Console Coverage Errors – WooCommerce
Google Search Console alerts users when certain pages submitted in the sitemap are set to no-index and generates a coverage error, this can include WooCommerce pages like… /cart /checkout /my-account /?-add-to-cart These pages shouldn’t be cached or indexed and are correctly set to noindex, to remove the Search Console error you can add these pages…
Read More