Description
Product Price by Formula for WooCommerce plugin lets you set formula for automatic WooCommerce product price calculation.
Plugin settings are accessible via “WooCommerce > Settings > Product Price by Formula”.
Bulk Settings
 Enable for all products
 Enables price calculation by formula for all products.
 Default:
no
 Default:
 Use same formula
 Enables same formula for all products. Possible values: No; Yes (with individual params); Yes (with same params).
 Default:
No
 Default:
Admin Settings
 Add dashboard widget
 Adds default settings admin dashboard widget.
 Default:
no
 Default:
 Products list columns
 Adds columns to the admin products list. Possible values: Formula; Params; Price.
 Default: None
Advanced Settings
 Shortcodes prefix
 Optional prefix for all plugin’s shortcodes. E.g.: if set to
my_prefix_
, will transform[math_round]
to[my_prefix_math_round]
. Default: None
 Price filters priority
 Priority for WooCommerce price filters. Set to zero to use the default priority.
 Default:
0
 Default:
Default Formula Settings
You can set default settings here. All settings can later be changed on individual product’s edit page (in Product Price by Formula meta box).
In formula use x
variable for product’s base price. For example: x+p1*p2
. Please note that you can not use x
or pN
inside other params.
In formula and/or params use can also use shortcodes.
Please note that if you are using caching plugins and dynamic product pricing (e.g.: price changing with product stock ([product_stock]
) or by customer’s location ([if_customer_location]
)), then caching needs to be disabled for products pages. If you want to keep caching enabled, you will need to cache product pages for each condition: for example for [if_customer_location]
you can set Default customer location option to Geolocate (with page caching support) in WooCommerce > Settings > General.
 Formula
 Price formula.
 Default: None
 Number of parameters
 Save settings after you change this number – new settings fields will appear.
 Default:
1
 Default:
 pN: Value
 Parameter value.
 Default: None
 pN: Admin note (optional)
 Optional parameter admin note.
 Default: None
Shortcodes
[math_round]
– Rounding shortcode. Number of decimals can be set with precision
attribute.
Example
[math_round precision="1"][if_customer_location country="US,CA"]x*1.10[/if_customer_location][if_customer_location not_country="US,CA"]x*1.20[/if_customer_location][/math_round]
[math_ceil]
– Rounding up (ceil).
Example
[math_ceil]x*[product_weight][/math_ceil]
[math_floor]
– Rounding down (floor).
Example
[math_floor]x*[product_length][/math_floor]
[math_min]
– Min value.
Example
[math_min value1="x*p1" value2="x*p2"]
[math_max]
– Max value.
Example
[math_max value1="x*p1" value2="{product_total_sales}"]
[product_meta]
– Retrieves any meta for the product. Meta key is set by required key
attribute.
Example
[product_meta key="_weight"]
[product_total_sales]
– Retrieves product’s total sales number.
Example
[product_total_sales]
[product_stock]
– Retrieves product’s stock.
Example
[product_stock]
[product_weight]
– Retrieves product’s weight.
Example
[product_weight]
[product_length]
– Retrieves product’s length.
Example
[product_length]
[product_width]
– Retrieves product’s width.
Example
[product_width]
[product_height]
– Retrieves product’s height.
Example
[product_height]
[product_id]
– Product’s ID.
Example
[if_value value="{product_id}" compare_operator="in" compare_to_value="100,101,102"]x*4.9[/if_value][if_value value="{product_id}" compare_operator="not_in" compare_to_value="100,101,102"]x*5.5[/if_value]
[product_attr]
– Retrieves product’s attribute. Attribute is set by required attribute
attribute.
Example
[product_attr attribute="size"]
[if_customer_location]
– Price by customer’s location (by IP).
Example
[if_customer_location country="US,CA"]x*1.10[/if_customer_location][if_customer_location not_country="US,CA"]x*1.20[/if_customer_location]
[if_time]
– Price by current time.
Example
[if_time from="00:00:00" to="11:59:59"]x*1.10[/if_time][if_time from="12:00:00" to="23:59:59"]x*1.20[/if_time]
[if_date]
– Price by current date.
Example
[if_date from="20180915 00:00:00" to="20181015 23:59:59"]x*1.10[/if_date][if_date from="20181016 00:00:00" to="20190914 23:59:59"]x*1.20[/if_date]
[if_user_role]
– Price by customer’s user role.
Example
[if_user_role role="guest,administrator"]x*1.10[/if_user_role][if_user_role not_role="guest,administrator"]x*1.20[/if_user_role]
[if_product_category]
– Price by product’s category.
Example
x[if_product_category slug="cat1,cat2"]*1.10[/if_product_category][if_product_category not_slug="cat1,cat2"]*1.20[/if_product_category]
[if_product_tag]
– Price by product’s tag.
Example
x[if_product_tag slug="tag1,tag2"]*1.10[/if_product_tag][if_product_tag not_slug="tag1,tag2"]*1.20[/if_product_tag]
[if_product_taxonomy]
– Price by product’s taxonomy (any).
Example
x[if_product_taxonomy taxonomy="product_cat" slug="cat1,cat2"]*1.10[/if_product_taxonomy][if_product_taxonomy taxonomy="product_cat" not_slug="cat1,cat2"]*1.20[/if_product_taxonomy]
[if_value]
– Compares any two values. Required attributes: value
, compare_operator
and compare_to_value
. Possible compare operators are: equal
, not_equal
, less
, less_or_equal
, greater
, greater_or_equal
, in
, not_in
, between
, not_between
. There is also inclusive
attribute for between
, not_between
compare operators.
Example
x[if_value value="{product_meta key='_weight'}" compare_operator="less" compare_to_value="1.5"]*4.9[/if_value][if_value value="{product_meta key='_weight'}" compare_operator="greater_or_equal" compare_to_value="1.5"]*5.5[/if_value]
[if_product_id]
– Price by product’s ID.
Example
[if_product_id compare_operator="in" compare_to_value="100,101,102"]x*4.9[/if_product_id][if_product_id compare_operator="not_in" compare_to_value="100,101,102"]x*5.5[/if_product_id]
[if_regular_price]
– Apply formula to regular product price.
Example
x[if_regular_price]*2[/if_regular_price][if_sale_price]/2[/if_sale_price]
[if_sale_price]
– Apply formula to sale product price.
Example
x[if_regular_price]*2[/if_regular_price][if_sale_price]/2[/if_sale_price]
[option]
– Site option.
Example
x+[option name="my_option_name" default="1"]
Usage Examples
Example 1
Let’s say product’s standard (i.e. original) price is $50 and its stock is 15 pcs. If you set Formula to x+p1*p2
, Number of parameters to 2
, p1 to 1.5
and p2 to [product_stock]
, then final price will be 50 + 1.5 * 15 = 72.5
, i.e. $72.50.
Example 2
Let’s say you need to use [if_value]
shortcode. While you could enter value
directly, usually you will need to retrieve it from another shortcode or meta field, e.g. product weight. As placing [
, ]
and "
in shortcode’s attributes is not allowed in WordPress, you will need to replace it with {
, }
and '
accordingly, e.g.:
x[if_value value="{product_meta key='_weight'}" compare_operator="less" compare_to_value="1.5"]*4.9[/if_value][if_value value="{product_meta key='_weight'}" compare_operator="greater_or_equal" compare_to_value="1.5"]*5.5[/if_value]
In the example above: product’s original price (x
) will be multiplied by 4.9
in case if product weight ({product_meta key='_weight'}
) is less than 1.5
. And it will be multiplied by 5.5
if product weight is greater or equal to 1.5
.
Moreover you can add shortcodes inside [if_value]
shortcode’s content, e.g.:
[if_value value="{product_meta key='_weight'}" compare_operator="less" compare_to_value="1.5"][product_meta key="_length"]*4.9[/if_value][if_value value="{product_meta key='_weight'}" compare_operator="greater_or_equal" compare_to_value="1.5"][product_meta key="_length"]*5.5[/if_value]
Free vs Pro
Free Version  Pro Version  

Enable for all products  
Use same formula  
Shortcodes  All except:

Prices & Licenses
Single site  Unlimited sites  
1 year  $19.99 / year  $29.99 / year 
Lifetime  $39.99  $59.99 
djmfxp –
hi
i want buy and use “Product Price by Formula for WooCommerce”
but i want know some details
i want use a unique single formula for all products(all product use a one formula)
but any products use own paramaters for universal formula.
can i do with this plugin?
Tom Anbinder (product author) –
Yes, that is possible by selecting “Yes (with individual params)” option in “Use same formula” dropdown in plugin’s “General” settings.
Ajay Maharjan –
hello!
Before purchasing the API I would like to know if you can calculate with below example
Product value = round(Price * Product Weight * 1.15,0)
*Price: Need to change every day for bulk products ( around 200 items)
*Product weight: Will input by a user at the time of product entry.
* 1.15: just a number
Tom Anbinder (product author) –
Hi,
Sorry for a late reply.
Yes, that is possible. Please set this as (Default) Formula:
or more generally:
Hope that helps.