---
title: "Is it possible to invoice in the name of more than one company in WooCommerce?"
description: "Some time ago a customer asked us for a piece of custom code in order to be able to invoice in the name of two companies simultaneously in the same WooCommerce. In his particular case he provides services exclusively and,"
url: https://artprojectgroup.com/is-it-possible-to-invoice-in-the-name-of-more-than-one-company-in-woocommerce
date: 2023-09-20
modified: 2023-09-20
author: "Art Project Group"
image: https://artprojectgroup.com/wp-content/uploads/2023/04/woocommerce-blog.webp
categories: ["Tutorials"]
tags: ["functions.php", "PHP", "WooCommerce"]
type: post
lang: en-US
---

# Is it possible to invoice in the name of more than one company in WooCommerce?

Some time ago a customer asked us for a piece of custom code in order to be able to invoice in the name of two companies simultaneously in the same WooCommerce.

In his particular case he provides services exclusively and, depending on the type of service purchased, he needed the invoice to be issued in the name of one company or the other. To issue the invoices he uses the free version of the fantastic plugin for WooCommerce [PDF Invoices & Packing Slips for WooCommerce](https://wordpress.org/plugins/woocommerce-pdf-invoices-packing-slips/).

### But is it possible to do it?

If the installation were of the multi-shop (marketplace) type and used some specific plugin such as [WCFM Marketplace – Best Multivendor Marketplace for WooCommerce](https://wordpress.org/plugins/wc-multivendor-marketplace/), [Dokan – Best WooCommerce Multivendor Marketplace Solution – Build Your Own Amazon, eBay, Etsy](https://wordpress.org/plugins/dokan-lite/) or [WC Vendors – WooCommerce Multivendor, WooCommerce Marketplace, Product Vendors, Commissions, Multi Seller](https://wordpress.org/plugins/wc-vendors/), to mention only a few of the many plugins that populate the WordPress ecosystem, it would be as simple as creating two or more vendors and associating each product with them, and the plugin in question would already take care of telling the invoicing plugin the corresponding data of each vendor, but this was not the case.

But yes, it is possible to invoice in a single WooCommerce in the name of two or more different companies, as long as products from different companies are not mixed in the purchase, for example by limiting the purchase to a single product or by limiting the purchase to a single category, which is what we did in this particular case.

For this you have to organise the products correctly by categories, in this case two, one for each company, and add some custom code to work the miracle.

### Let us get to work

As we have already indicated, the first thing is to organise the whole catalogue into a couple of categories, if you are going to invoice in the name of two different companies; if you need more you will have to create as many categories as companies you are going to need.

Once your catalogue is organised you have to add some custom code. Let us start with the simple part, limiting the purchase to a single category.

For this we are going to use the *functions.php* file of the child theme, or you can create a small custom plugin to carry out these tasks. In either case we are going to use PHP code similar to this:

Copy to clipboardSyntax Highlighter
