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.

  • Change the placeholder image

    Change the placeholder image

    Automattic Avatar
    Automattic

    |

    Mar 3, 2012


    The placeholder image can now be set at: WooCommerce > Settings > Products as of version 3.5x. More info at: Configuring WooCommerce Settings. WooCommerce 3.4x or earlier Add code to… Read more

  • WooCommerce payment gateway plugin base

    WooCommerce payment gateway plugin base

    Automattic Avatar
    Automattic

    |

    Mar 3, 2012


    This code can be used as a base to create your own simple custom payment gateway for WooCommerce. If not used in a custom plugin, you need to add this… Read more

  • Change email subject lines

    Change email subject lines

    Automattic Avatar
    Automattic

    |

    Feb 27, 2012


    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

  • Allow shortcodes in product excerpts

    Allow shortcodes in product excerpts

    Automattic Avatar
    Automattic

    |

    Feb 17, 2012


    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

  • Custom tracking code for the thanks page

    Custom tracking code for the thanks page

    Automattic Avatar
    Automattic

    |

    Feb 16, 2012


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

  • Change number of upsells output

    Change number of upsells output

    Automattic Avatar
    Automattic

    |

    Feb 12, 2012


    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 number of related products output

    Change number of related products output

    Automattic Avatar
    Automattic

    |

    Feb 12, 2012


    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

  • Hide loop read more buttons for out of stock items

    Hide loop read more buttons for out of stock items

    Automattic Avatar
    Automattic

    |

    Feb 6, 2012


    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 as the Code snippets plugin. Please… Read more

  • Show cart contents / total

    Show cart contents / total

    Automattic Avatar
    Automattic

    |

    Feb 3, 2012


    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 My Account link in a template file

    Display My Account link in a template file

    Automattic Avatar
    Automattic

    |

    Feb 3, 2012


    Displays a link to the user account section. If the user is not logged in the link will display ‘Login / Register’ and take the use to the login /… Read more

  • Exclude products from a particular category on the shop page

    Exclude products from a particular category on the shop page

    Automattic Avatar
    Automattic

    |

    Jan 30, 2012


    As ‘clothing’ is an example in the snippet below, be sure to use a product category slug that exists in your WooCommerce store. Note that this will only work when… Read more

  • Add a custom currency / symbol

    Add a custom currency / symbol

    Automattic Avatar
    Automattic

    |

    Jan 30, 2012


    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

←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.