Rexivue Lens Prescription adds a prescription table to WooCommerce product pages, built for contact lenses and similar optical products.
Rexivue is an independent plugin. It is not affiliated with, or endorsed by, WooCommerce or Automattic.
For each product you choose:
- Which eyes to ask about: left (OS), right (OD) or both.
- Which powers to ask for: SPH, CYL and/or AXIS, each with its own list of allowed values.
- Whether customers may attach a prescription image or PDF.
On the product page the customer picks values and the number of boxes for each eye. The cart quantity becomes the total number of boxes (left + right), and WooCommerce charges its normal product (or variation) price for each box. The prescription is shown in the cart, mini-cart, checkout and order, and is saved on the order line item.
Features
- Per-product configuration in a "Prescription" tab of the product data box (simple and variable products).
- SPH / CYL / AXIS dropdowns per eye, with admin-defined value lists.
- AXIS is only enabled when a non-zero CYL is selected (positive or negative).
- Number of boxes per eye (1–10 by default); cart quantity = total boxes.
- Live "total for selected boxes" using the store's currency format; variation prices update automatically.
- Optional prescription upload (JPG, PNG, GIF, WebP or PDF), stored privately.
- Works with the classic cart/checkout and the Cart and Checkout blocks.
- Compatible with High-Performance Order Storage (HPOS).
- "Order again" re-uses the original prescription when it is still valid.
- Works with themes that add to cart over AJAX on the product page.
- Translation-ready.
How pricing works
The plugin never sets or reads a price from the browser. The line quantity is set on the server from the validated number of boxes, and WooCommerce multiplies its own product price by that quantity, so taxes, coupons and currency plugins behave as normal.
Security
- Every submitted value is checked on the server against the product's configured options. Anything else is rejected with an error message.
- Box counts must be whole numbers from 1 to the maximum.
- The quantity is locked to the number of boxes in the classic cart, the Cart block and the Store API, and re-checked before checkout.
- Variation IDs must belong to the product being added.
- Admin saves are protected by a nonce and the
edit_product capability.
- Uploaded prescriptions are checked for real file type and size, stored under random names in
wp-content/uploads/rexivue-prescriptions/, and can only be downloaded by users with the edit_shop_orders capability through a nonce-protected link on the order screen.
- Make sure WooCommerce 8.2 or newer is installed and active.
- Upload the
rexivue-lens-prescription folder to /wp-content/plugins/, or upload the zip under Plugins > Add New > Upload Plugin.
- Activate the plugin.
- Edit a product, open the Prescription tab and enable the eyes and fields you need.
Switching from an earlier build
Earlier private builds of this plugin were named "YLS Product Custom Fields" or "Optical Custom Fields". To switch:
- Deactivate the earlier build.
- Install and activate Rexivue Lens Prescription. On activation it copies each product's prescription settings into its own prefixed keys. Orders, carts and prescription files from the earlier build stay readable.
- Check a product page, then delete the earlier build.
While an earlier build is active, Rexivue pauses itself and shows a notice on the Plugins screen, so the prescription table is never shown twice.
Nginx
The upload directory is protected with an
.htaccess file on Apache and LiteSpeed. On Nginx add a rule like this to your server block, then reload Nginx:
location ^~ /wp-content/uploads/rexivue-prescriptions/ { deny all; return 403; }
Files also use random, unguessable names, but the rule above is strongly recommended.