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.

  • Demo your Woo extension with WordPress Playground

    Demo your Woo extension with WordPress Playground

    Ján Mikláš Avatar
    Ján Mikláš

    |

    Jan 24, 2025


    Want to learn how to demo your Woo Extension anywhere you go with WordPress Playground? Check out our latest tutorial that will get you showing off your extension in minutes! Read more

  • New WooCommerce blocks cart item image filter

    New WooCommerce blocks cart item image filter

    Thomas Roberts Avatar
    Thomas Roberts

    |

    Jan 16, 2025


    WooCommerce 9.6 introduces a filter to modify cart item images in Cart & Checkout blocks via the Store API response. 🎨 Customize with ease! 📖 Learn more: Read more

  • Apply a coupon for minimum cart total

    Apply a coupon for minimum cart total

    Automattic Avatar
    Automattic

    |

    Jan 21, 2019


    The code snippet below allows you to: Requirements: Add this code to your child theme’s functions.php file or via a plugin that allows custom functions to be added, such as… Read more

  • Hide trailing zeros on prices

    Hide trailing zeros on prices

    Automattic Avatar
    Automattic

    |

    Sep 25, 2018


    The option to show trailing zeros on your prices has been removed in favor of a filter, as of WooCommerce 2.2x. If you want to hide trailing zeros on your… Read more

  • Notify Admin When New Account Is Created

    Notify Admin When New Account Is Created

    Automattic Avatar
    Automattic

    |

    Mar 11, 2018


    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

  • Display product weight on archive pages

    Display product weight on archive pages

    Automattic Avatar
    Automattic

    |

    May 10, 2017


    To display WooCommerce product weight on archive pages, below the title of the product, add this code to your child theme’s functions.php file or via a plugin that allows custom functions to… Read more

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

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

    Automattic Avatar
    Automattic

    |

    Mar 24, 2016


    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

  • Add a message above the login / register form

    Add a message above the login / register form

    Automattic Avatar
    Automattic

    |

    Oct 1, 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

  • Add a new country to countries list

    Add a new country to countries list

    Automattic Avatar
    Automattic

    |

    Aug 12, 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

  • Adjust the quantity input values

    Adjust the quantity input values

    Automattic Avatar
    Automattic

    |

    Jul 23, 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

  • Send coupons used in an order by email

    Send coupons used in an order by email

    Automattic Avatar
    Automattic

    |

    Jul 10, 2013


    This snippet sends by email the list of coupons used in an order. You can customize the “$to” variable and define your own email address, and the “$message” to have… Read more

  • Customize the WooCommerce breadcrumb

    Customize the WooCommerce breadcrumb

    Automattic Avatar
    Automattic

    |

    Jun 24, 2013


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

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.