Learn how to set up, customize, and expand the functionality of your WooCommerce products with our library of documentation and tutorials.
  1. Documentation /
  2. Code Snippets /
  3. General Snippets

General Snippets


Documents

  • Add a custom currency / symbol

    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 file contains bidirectional Unicode text […]

  • Add a custom field (in an order) to the emails

    You can add any custom field to your order emails by hooking in and specifying the name of the custom field. This can be useful if, for example, you want to include things like the ‘transaction key’ from PayPal orders. Alternatively, you can add the code snippet using Code Snippet plugin. Here is an example using […]

  • Add a new country to countries list

    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 file contains bidirectional Unicode text […]

  • Add/Modify States

    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 your own or modify shipping states in […]

  • Adjust the quantity input values

    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. Set the starting value, maximum value, minimum value […]

  • Allow shortcodes in product excerpts

    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 […]

  • Allowing customer access to WP Admin, and enabling the admin bar

    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, WooCommerce blocks non-admin users from entering […]

  • Automatically add product to cart on visit

    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 […]

  • Change a currency symbol

    See currency list for reference on currency codes. 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. […]

  • Change email subject lines

    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 […]