Documentation

Learn how to set up, customize, and expand the functionality of WooCommerce

Frontend Snippets


Documents

  • Add a message above the login / register form

    Add this code to your child theme’s functions.php file or via a plugin that allows custom functions to be added, such as the Code snippets plugin. Please don’t add custom code directly to your parent theme’s functions.php file as this will be wiped entirely when you update the theme. This code will add a custom […]

  • Add a surcharge to cart and checkout – uses fees API

    Add code to your child theme’s functions.php file or via a plugin that allows custom functions to be added, such as the Code snippets plugin. Avoid adding custom code directly to your parent theme’s functions.php file as this will be wiped entirely when you update the theme. Add a percentage based surcharge to all transactions […]

  • Allow HTML in term (category, tag) descriptions

    Add code to your child theme’s functions.php file or via a plugin that allows custom functions to be added, such as the Code snippets plugin. Avoid adding custom code directly to your parent theme’s functions.php file as this will be wiped entirely when you update the theme. By default, WordPress strips HTML from category descriptions. […]

  • Apply a coupon for minimum cart total

    The code snippet below allows you to: Show a notice on the cart and checkout page, reminding customers that they get a discount if spending more than a minimum amount. Automatically apply a discount and show a notice that the discount was applied when the cart total is more than a minimum amount. Requirements: A coupon called […]

  • Change Limit on Number of Variations for Dynamic Variable Product Dropdowns

    By default, if a Variable product has fewer than 30 variations, the dropdowns for selecting variations on the frontend will be dynamic. For example, with a T-shirt that has “Size” and “Color” attributes, after the customer selects a Size, the Color dropdown will be updated via AJAX to only display options that are available with […]

  • Change the default state and country on the checkout

    Add code to your child theme’s functions.php file or via a plugin that allows custom functions to be added, such as the Code snippets plugin. Avoid adding custom code directly to your parent theme’s functions.php file as this will be wiped entirely when you update the theme. This file contains bidirectional Unicode text that may […]

  • Check if address field contains house number (using WooCommerce Blocks)

    Currently, when using the Checkout block from the WooCommerce Blocks plugin, there’s no check if the billing or shipping address field contains a house number. The following code snippets allow to check if these fields contain a number. You need to add code to your child theme’s functions.php file or via a plugin that allows […]

  • Custom sorting options (asc/desc)

    A snippet to add new sorting options to the catalog.

  • Custom tracking code for the thanks page

    This snippet is for adding tracking for a separate piece of analytic software you may have installed. The order object contains all the order data you should need, including line items. You need to add this code to your child theme’s functions.php file or via a plugin that allows custom functions to be added, such […]

  • Customize the WooCommerce breadcrumb

    You need to add code to your child theme’s functions.php file or via a plugin that allows custom functions to be added, such as the Code snippets plugin. Please don’t add custom code directly to your parent theme’s functions.php file as this will be wiped entirely when you update the theme. Change the ‘Home’ text […]

Use of your personal data
We and our partners process your personal data (such as browsing data, IP Addresses, cookie information, and other unique identifiers) based on your consent and/or our legitimate interest to optimize our website, marketing activities, and your user experience.