{"id":386904,"date":"2026-10-13T23:51:50","date_gmt":"2026-10-13T23:51:50","guid":{"rendered":"https:\/\/wordpress.org\/plugins\/hdwebmobile-formula-pricing\/"},"modified":"2026-10-14T08:42:32","modified_gmt":"2026-10-14T08:42:32","slug":"hdwebmobile-formula-pricing","status":"publish","type":"plugin","link":"https:\/\/et.wordpress.org\/plugins\/hdwebmobile-formula-pricing\/","author":9757813,"comment_status":"closed","ping_status":"closed","template":"","meta":{"version":"1.0.0","stable_tag":"1.0.0","tested":"7.1.3","requires":"6.9","requires_php":"7.4","requires_plugins":null,"header_name":"HDWebmobile Formula Pricing","header_author":"htrxuan - Han Tran","header_description":"Price a product from customer-entered numbers (width, height, quantity, etc.) using a merchant-defined formula -- evaluated by a safe, allow-list-only expression parser, never PHP's eval().","assets_banners_color":"66958b","last_updated":"2026-10-14 08:42:32","external_support_url":"","external_repository_url":"","donate_link":"https:\/\/paypal.me\/htrxuan\/20","header_plugin_uri":"https:\/\/hdwebmobile.com\/plugins\/hdwebmobile-formula-pricing\/","header_author_uri":"https:\/\/hdwebmobile.com\/","rating":0,"author_block_rating":0,"active_installs":0,"downloads":60,"num_ratings":0,"support_threads":0,"support_threads_resolved":0,"author_block_count":0,"sections":["description","installation","changelog"],"tags":{"1.0.0":{"tag":"1.0.0","author":"htrxuan","date":"2026-10-14 08:42:32","revision":3745742}},"upgrade_notice":[],"ratings":[],"assets_icons":{"icon-128x128.png":{"filename":"icon-128x128.png","revision":3745071,"resolution":"128x128","location":"assets","locale":"","width":128,"height":128},"icon-256x256.png":{"filename":"icon-256x256.png","revision":3745071,"resolution":"256x256","location":"assets","locale":"","width":256,"height":256}},"assets_banners":{"banner-1544x500.png":{"filename":"banner-1544x500.png","revision":3745071,"resolution":"1544x500","location":"assets","locale":"","width":1544,"height":500},"banner-772x250.png":{"filename":"banner-772x250.png","revision":3745071,"resolution":"772x250","location":"assets","locale":"","width":772,"height":250}},"assets_blueprints":{},"all_blocks":[],"tagged_versions":["1.0.0"],"block_files":[],"assets_screenshots":{"screenshot-1.png":{"filename":"screenshot-1.png","revision":3745071,"resolution":"1","location":"assets","locale":"","width":1600,"height":1000},"screenshot-2.png":{"filename":"screenshot-2.png","revision":3745071,"resolution":"2","location":"assets","locale":"","width":1600,"height":1000},"screenshot-3.png":{"filename":"screenshot-3.png","revision":3745071,"resolution":"3","location":"assets","locale":"","width":1600,"height":1000}},"screenshots":{"1":"The Formula Pricing tab on a product's edit screen -- fields and formula configuration.","2":"The customer-facing input fields and live price preview on the product page.","3":"A cart line item showing the entered measurements alongside the computed price."}},"plugin_section":[],"plugin_tags":[716,244387,15963,15435,286],"plugin_category":[45,59],"plugin_contributors":[254181],"plugin_business_model":[],"class_list":["post-386904","plugin","type-plugin","status-publish","hentry","plugin_tags-calculator","plugin_tags-custom-pricing","plugin_tags-dynamic-pricing","plugin_tags-formula","plugin_tags-woocommerce","plugin_category-ecommerce","plugin_category-utilities-and-tools","plugin_contributors-htrxuan","plugin_committers-htrxuan"],"banners":{"banner":"https:\/\/ps.w.org\/hdwebmobile-formula-pricing\/assets\/banner-772x250.png?rev=3745071","banner_2x":"https:\/\/ps.w.org\/hdwebmobile-formula-pricing\/assets\/banner-1544x500.png?rev=3745071","banner_rtl":false,"banner_2x_rtl":false},"icons":{"svg":false,"icon":"https:\/\/ps.w.org\/hdwebmobile-formula-pricing\/assets\/icon-128x128.png?rev=3745071","icon_2x":"https:\/\/ps.w.org\/hdwebmobile-formula-pricing\/assets\/icon-256x256.png?rev=3745071","generated":false},"screenshots":[{"src":"https:\/\/ps.w.org\/hdwebmobile-formula-pricing\/assets\/screenshot-1.png?rev=3745071","caption":"The Formula Pricing tab on a product's edit screen -- fields and formula configuration."},{"src":"https:\/\/ps.w.org\/hdwebmobile-formula-pricing\/assets\/screenshot-2.png?rev=3745071","caption":"The customer-facing input fields and live price preview on the product page."},{"src":"https:\/\/ps.w.org\/hdwebmobile-formula-pricing\/assets\/screenshot-3.png?rev=3745071","caption":"A cart line item showing the entered measurements alongside the computed price."}],"raw_content":"<!--section=description-->\n<p>HDWebmobile Formula Pricing lets customers enter measurements or quantities on the product page, and prices the product live from a formula you write using those field names (e.g. <code>10 + width * height * 0.05<\/code> for a custom-cut material priced by area). This is a common real need for stores selling custom-sized fabric, framed prints, engraved items, or anything priced by dimension or quantity, not just a flat number.<\/p>\n\n<h4>Security by design<\/h4>\n\n<p>The simplest way to implement formula-based pricing -- passing the merchant's formula text straight into PHP's <code>eval()<\/code> at calculation time -- is also the most dangerous: it turns any formula input into a remote code execution path. This plugin closes that entire vulnerability class by construction:<\/p>\n\n<ul>\n<li>The formula is tokenized character-by-character into a strict set of allowed pieces: numbers, your own configured field names, and the four arithmetic operators plus parentheses. Anything else in the formula text -- any other letter sequence, any function-call-looking pattern, any special character -- causes the formula to be rejected outright when you save it.<\/li>\n<li>The token stream is evaluated by a small hand-written arithmetic parser. There is no <code>eval()<\/code>, no <code>create_function()<\/code>, no dynamic function dispatch of any kind anywhere in this plugin -- the only operations that can ever run are addition, subtraction, multiplication, and division of plain numbers.<\/li>\n<li>The customer-facing live price preview also never exposes your formula to the browser: it's computed by an AJAX call back to your own server, through the exact same safe evaluator used at checkout, so the formula text itself is never sent to a visitor's browser.<\/li>\n<li>The real price used at checkout is always recomputed server-side from the product's own stored fields and formula -- never trusted from what the browser submitted.<\/li>\n<\/ul>\n\n<h4>Key Features<\/h4>\n\n<ul>\n<li>Add up to 6 numeric input fields per product (label, variable name, min\/max bounds, default value)<\/li>\n<li>Write a formula referencing those fields by name -- validated for safety the moment you save it<\/li>\n<li>Live price preview on the product page as the customer types, computed server-side<\/li>\n<li>Optional minimum\/maximum price clamps, so no combination of inputs can produce an unreasonable price<\/li>\n<li>Every field's min\/max bounds are enforced again server-side at add-to-cart time, not just in the browser<\/li>\n<li>Field values show on the cart, checkout, and order screens exactly as entered<\/li>\n<\/ul>\n\n<h4>Limitations (please read before installing)<\/h4>\n\n<ul>\n<li>Simple products only in this version -- no variable-product support<\/li>\n<li>Formulas support only +, -, *, \/, and parentheses (no exponents, square roots, or conditional logic) -- deliberately, since a richer grammar is a larger safety surface to get right<\/li>\n<li>No formula \"test\" button in the admin beyond the save-time validation -- if a formula is rejected, the error message names exactly what's wrong (an unknown variable, a bad character, division by zero with the values you tried)<\/li>\n<li>Requires a Regular Price to be set on the product (even a nominal placeholder) -- this is standard WooCommerce behavior for any product with no price at all, not something this plugin can work around<\/li>\n<\/ul>\n\n<h4>Enjoying this plugin?<\/h4>\n\n<p>If it helps your site, please consider <a href=\"https:\/\/wordpress.org\/support\/plugin\/hdwebmobile-formula-pricing\/reviews\/#new-post\">leaving an honest review on WordPress.org<\/a> -- it helps other WordPress users find it. Found a problem or have an idea? Please <a href=\"https:\/\/wordpress.org\/support\/plugin\/hdwebmobile-formula-pricing\/\">open a support topic<\/a> first so it can be fixed.<\/p>\n\n<h3>How to Use<\/h3>\n\n<h4>1. Add your input fields<\/h4>\n\n<p>On a simple product's \"Formula Pricing\" tab, click \"+ Add Field\" for each number the customer should enter (e.g. \"Width in cm\" with variable name <code>width<\/code>). Set a minimum, an optional maximum, and a default value for each.<\/p>\n\n<h4>2. Write the formula<\/h4>\n\n<p>In the Formula box, write an expression using your field names exactly as shown, e.g. <code>10 + width * height * 0.05<\/code>. Save the product -- if the formula uses anything other than your field names, numbers, and <code>+ - * \/ ( )<\/code>, you'll see exactly what's wrong and the formula won't be saved until it's fixed.<\/p>\n\n<h4>3. What the customer sees<\/h4>\n\n<p>The product page shows your input fields above the Add to Cart button, with a live estimated price that updates as they type. The real price is confirmed the moment the product is actually added to the cart.<\/p>\n\n<h4>4. Keeping prices sane<\/h4>\n\n<p>Set an optional minimum and\/or maximum price on the same tab -- no matter what a customer enters (within their allowed field ranges), the final price is clamped to stay within those bounds.<\/p>\n\n<!--section=installation-->\n<ol>\n<li>Upload the plugin files to the <code>\/wp-content\/plugins\/hdwebmobile-formula-pricing<\/code> directory, or install the plugin through the WordPress plugins screen directly.<\/li>\n<li>Activate the plugin through the 'Plugins' screen in WordPress. WooCommerce must already be installed and active.<\/li>\n<li>Edit a simple product, open its new \"Formula Pricing\" tab under Product Data, add your fields and formula.<\/li>\n<li>On the product's \"General\" tab, set a Regular Price -- WooCommerce hides the entire purchase form on a product with no price at all, even with formula pricing enabled, so enter at least a nominal placeholder amount (it will be overridden the moment a customer enters a value).<\/li>\n<\/ol>\n\n<!--section=changelog-->\n<h4>1.0.0<\/h4>\n\n<ul>\n<li>Initial release: per-product numeric input fields, safe formula evaluation via a hand-written tokenizer and recursive-descent parser (no eval()), server-side live price preview via AJAX, min\/max price clamping, field values shown on cart\/checkout\/order screens.<\/li>\n<\/ul>","raw_excerpt":"Price a product from customer-entered numbers using a formula -- evaluated safely, never with PHP's eval().","jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/et.wordpress.org\/plugins\/wp-json\/wp\/v2\/plugin\/386904","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/et.wordpress.org\/plugins\/wp-json\/wp\/v2\/plugin"}],"about":[{"href":"https:\/\/et.wordpress.org\/plugins\/wp-json\/wp\/v2\/types\/plugin"}],"replies":[{"embeddable":true,"href":"https:\/\/et.wordpress.org\/plugins\/wp-json\/wp\/v2\/comments?post=386904"}],"author":[{"embeddable":true,"href":"https:\/\/et.wordpress.org\/plugins\/wp-json\/wporg\/v1\/users\/htrxuan"}],"wp:attachment":[{"href":"https:\/\/et.wordpress.org\/plugins\/wp-json\/wp\/v2\/media?parent=386904"}],"wp:term":[{"taxonomy":"plugin_section","embeddable":true,"href":"https:\/\/et.wordpress.org\/plugins\/wp-json\/wp\/v2\/plugin_section?post=386904"},{"taxonomy":"plugin_tags","embeddable":true,"href":"https:\/\/et.wordpress.org\/plugins\/wp-json\/wp\/v2\/plugin_tags?post=386904"},{"taxonomy":"plugin_category","embeddable":true,"href":"https:\/\/et.wordpress.org\/plugins\/wp-json\/wp\/v2\/plugin_category?post=386904"},{"taxonomy":"plugin_contributors","embeddable":true,"href":"https:\/\/et.wordpress.org\/plugins\/wp-json\/wp\/v2\/plugin_contributors?post=386904"},{"taxonomy":"plugin_business_model","embeddable":true,"href":"https:\/\/et.wordpress.org\/plugins\/wp-json\/wp\/v2\/plugin_business_model?post=386904"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}