Woo | Developer Blog
  • Get started
  • Stay updated
    • Roadmap Insights
    • Changelog
    • Release downloads
    • Newsletter
    • WooCommerce Meetups
    • Join the Community Slack
  • Grow with Woo
    • Become a Woo agency partner
    • Become a Marketplace partner
    • Contribute to WooCommerce
  • Docs

Code Snippets

Dive into practical solutions with our collection of code snippets. These bite-sized pieces of code are your quick fixes and custom enhancements for WooCommerce projects. Discover more code snippets at developer.woocommerce.com/docs.

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

    Add a surcharge to cart and checkout – uses fees API

    Automattic Avatar
    Automattic

    |

    Jun 13, 2013


    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… Read more

  • Configuring Zeus Server Rewrite Rules

    Configuring Zeus Server Rewrite Rules

    Automattic Avatar
    Automattic

    |

    Jun 10, 2013


    This rewrite.script has been configured for WordPress: RULE_0_START: # get the document root map path into SCRATCH:DOCROOT from / # initialize our variables set SCRATCH:ORIG_URL = %{URL} set SCRATCH:REQUEST_URI =… Read more

  • Minimum Order Amount

    Minimum Order Amount

    Automattic Avatar
    Automattic

    |

    May 24, 2013


    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… Read more

  • Change a currency symbol

    Change a currency symbol

    Automattic Avatar
    Automattic

    |

    May 9, 2013


    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… Read more

  • Query whether WooCommerce is activated

    Query whether WooCommerce is activated

    Automattic Avatar
    Automattic

    |

    Mar 22, 2013


    If you’re building a theme which supports but doesn’t require WooCommerce, you may want to wrap WooCommerce functionality (think cart links etc) inside a conditional query. That way, if WooCommerce isn’t activated, the… Read more

  • Rename a country in WooCommerce

    Rename a country in WooCommerce

    Automattic Avatar
    Automattic

    |

    Mar 17, 2013


    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. Avoid adding custom code… Read more

  • Remove product content based on category

    Remove product content based on category

    Automattic Avatar
    Automattic

    |

    Mar 16, 2013


    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. Avoid adding custom code… Read more

  • Hide sub-category product count in product archives

    Hide sub-category product count in product archives

    Automattic Avatar
    Automattic

    |

    Mar 14, 2013


    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… Read more

  • Editing product data tabs

    Editing product data tabs

    Automattic Avatar
    Automattic

    |

    Mar 11, 2013


    You need to add the 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… Read more

  • Add checkout validation styles to a third party or custom theme

    Add checkout validation styles to a third party or custom theme

    Automattic Avatar
    Automattic

    |

    Mar 1, 2013


    You need to add this CSS to your child theme’s style.css file or to your customizers’ “Additional CSS” section. Please don’t add custom code directly to your parent theme’s style.css… Read more

  • Make price widget draggable on touch devices

    Make price widget draggable on touch devices

    Automattic Avatar
    Automattic

    |

    Feb 27, 2013


    Resources Grab this script and save it to the JS folder in your theme directory. Installation Add code to your child theme’s functions.php file or via a plugin that allows… Read more

  • Hide other shipping methods when “Free Shipping” is available

    Hide other shipping methods when “Free Shipping” is available

    Automattic Avatar
    Automattic

    |

    Sep 16, 2012


    Overview By default, WooCommerce will show all shipping methods that match the customer and the cart contents. This means Free Shipping will also show along with Flat Rate and other… Read more

←Previous Page Next Page→

Updates

  • Changelog
  • Release Packages
  • Release Calendar
  • Newsletter
  • Status

Information

  • About
  • Contact Us

Community

  • Community Slack
  • WooCommerce Meetups
  • GitHub Discussions
  • Community Forum
  • Code of Conduct
  • Community Participation Guide

Grow with Woo

  • Become a Woo agency partner
  • Become a Marketplace partner
  • Contribute to WooCommerce

Never miss an update

This field is hidden when viewing the form
This field is hidden when viewing the form
This field is hidden when viewing the form

Automattic Company Site

COPYRIGHT WOOCOMMERCE 2026
TERMS & CONDITIONS  PRIVACY POLICY  PRIVACY NOTICE FOR CALIFORNIA USERS
Do not sell or share my personal information.