Logo
Start your printing business with WooCommerce and UniCPO

You have installed WordPress and WooCommerce, found a nice looking theme for your future website and is ready to add printing products. Reasonable questions: “What should I use for my online printing business? What is the right tool for that? How to create custom options for my WooCommerce products and configure price calculation so it will take into account width and length and thickness and plenty of other extra options?” I will not be beating around the bush and just answer you – use “WooCommerce Product Options and Price Calculation Formulas” plugin. No doubt this is a perfect WC extension for any online printing businesses. I am going to show you how to use it.

“What should I use for my online printing business?” – UniCPO is the answer!

A perfect tool for printing products

Let’s assume our product is Foamex Banner. I am going to briefly describe options we are about to implement to this product. We definitely want to let customers choose the size (width and height) and, what is even more important, we would like to give them a possibility to pick a measurement unit of their choice. Measurement units are: mm, cm, m, ft, in and yd. Enough, right? 🙂 Also, we have thickness option: 3mm, 5mm and 10mm. Each thickness option has its own base price per sq. m. and this value is different and depends on the area of an ordered item. Let’s also add “Laminate” option with these choices: none, matt laminated, gloss laminated. The latter two should add 50% to the price calculated by multiplying the base price per sq. m. to area calculated based on width and height provided by a customer. Finally, we would add Cutting Method option with two options: Square Cut Edges and Rounded Corners. Although this option does not impact the product price, we would let the customer choose a size of rounding with possible values from 5 to 25 mm. Of course, this additional input must be shown only if Rounded Corners option is chosen. That’s all.

Ok, let’s start making our product configuration. We will have 3 steps. Step 1 is adding options. Step 2 is configuring proper price calculation. Step 3 – add fields conditional logic to “Size of Rounding” option.

Step 1 – Adding options

First, create a product and set its price to something. Value ‘1’ works perfectly well. It could be anything, just do not leave it empty so WC will not treat it as a free item. Second, go to CPO visual builder and start adding modules.

Adding modules in UniCPO

A new Row is added and Column inside this Row is created automatically. Then Text input option is added. Now let’s configure this first option. This is “Width”. Then duplicate the first option, so creating “Height” is actually no time procedure. Then add “Measurement Unit”.

It is very important to keep slugs for suboptions as shown. Please, read more about this here.

Now add a new column (because we need to style nicely our options a bit later and it is better to add a new column now) and add a Select option for “Thickness”. Its suboptions are shown in the screenshot. Please, notice values for ‘Price/Rate’ settings. This is an important part of our configuration and it will be discussed a bit later.

Suboptions for Thickness Option

These are suboptions for “Laminate” option. Again, please notice values of ‘Price/Rate’ settings.

Suboptions for Laminate Option

Finally, add “Cutting Method” Select and “Size of Rounding” Text Input options.

Now go to General Settings and enable the first two settings and save them. This step enables displaying custom options and product price calculation.

This is how our form looks like on a single product page:

Our form. First iteration.

Some validation messages overlap some labels as well as it feels like a bit unstyled. But our powerful visual builder gives us an opportunity to style the form much much better and we will do that later for sure.

Step 2 – Configure price calculation

We are going to use non-option variables (NOV) to achieve our product configuration goal. So, open NOV settings modal window from the builder panel, enable this feature and add first two NOVs. These are our width and height values but converted to meters and area calculated in sq.m. Why? Because our base prices are in square meters, so we have to calculate the area in sq.m. However, we also let customers choose in which measurement units they want to add the desired width an height. So, we just use measurement units conversion feature of the plugin for our needs! This action lets the script know which unit we want to convert our values to.

Non-Option Variables

However, this is not enough. Because the script has to know somehow which unit our width and height are inputted in. Open Dimensions settings modal window and choose only one setting – Measurement unit and save. This action lets the script know which unit we want to convert our values from.

Dimension Settings

Now let’s add another one NOV and name it ‘base price’ and use matrix functionality. This functionality makes it possible to create a table of prices based on one or two options. Our first parameter is area and the second parameter is thickness. I am going to use a completely fake data just to give an understanding of how it works.

Matrix functionality makes it possible to create a table of prices based on one or two options.

Let’s assume our prices are as following:

  1. if the thickness is 3 mm: 3.11 if area less than or equal 1 sq.m., 3.07 if the area from 1 to 5 sq.m., 3.03 if the area larger than 5 sq.m.
  2. if the thickness is 5 mm: 5.11 if area less than or equal 1 sq.m., 5.07 if the area from 1 to 5 sq.m., 5.03 if the area larger than 5 sq.m.
  3. if the thickness is 10 mm: 10.11 if area less than or equal 1 sq.m., 10.07 if the area from 1 to 5 sq.m., 10.03 if the area larger than 5 sq.m.

Have you noticed that I used this value for ‘# in cols’ setting: “1|1.0001|5|5.0001”? The reason is that my area values are not discreet, they are in ranges. So, actually, I simulated ranges. The second and the third row in the table have the same pairs of values. It means that if the area is anything between 1.0001 and 5, the value 3.07 will be chosen for 3 mm thickness and so on.

Now we are ready to add our price calculation formula. Open Main Formula & Formulas Conditional Logic modal window and add the formula:

Main formula modal window
Our formula is:
{uni_nov_cpo_base_price}*{uni_nov_cpo_area}+{uni_nov_cpo_base_price}*{uni_nov_cpo_area}*{uni_cpo_foamex_laminate}

It consists of two parts:

  1. we multiply base price by the area
  2. optionally, we add the cost of laminating; do you remember “price/rate” settings values? the first was 0, so if “No” is chosen, then the value of this part of the formula will be equal to 0; if either “Matt” or “Gloss” is chosen base price will be multiplied by the area and multiplied by 0.5.

Cool! The product price calculation works!

Step 3 – Fields conditional logic and additional form styling

In this part, we are going to style our form more and enable fields conditional logic for “Size of Rounding” option, so it will be shown only if “Rounded Corners” is chosen.

Open “Size of Rounding” option settings modal window, go to ‘Conditional’ tab and configure the logic:

Mastering fields conditional logic

Important to click “Fetch the rule” after any changes in logic builder are made!

I have also styled the form a bit in this what I have now:

Our form. Final look.

This is a link to the product on our demo site. You can log in with demo/demo credentials and try to create your own product. This is a link to the export file for this product. If you use UniCPO 4 PRO already, you are able to import it (unzip first 🙂 ) and have a completely configured product on your site.

In case you have any question, please, feel free to ask it by contacting us via the form on this page.