Facebook Marketplace Price Per Unit
Free to download on every platform. Comes pre-installed on BotFone, BotPad and BotFlip — with extra free apps included.
About this app
WHAT IT DOES
This script adds a price-per-unit calculation to Facebook Marketplace listings, helping you compare the true value of different products. When you browse Marketplace, the script scans each listing for price and quantity information—things like "12-pack," "per pound," "each," or "box of 24." It then calculates the price per unit (per item, per pound, per ounce, per square foot, etc.) and displays it prominently near the listing price. This makes it easy to compare bulk items, multi-packs, and different sizes to find the best deal. The script supports a wide range of unit indicators including pack, box, case, each, lb, oz, sq ft, kg, g, ml, and L.
WHERE IT RUNS
The script runs on Facebook Marketplace pages (facebook.com/marketplace/*), commerce pages, buy/sell pages, and individual listing detail pages. It works on both desktop and mobile views.
HOW TO USE
After installation, the settings panel appears on the left side of the screen with the gear emoji (⚙️). Open the panel to configure the script:
- The "Enable price per unit calculation" toggle enables or disables the script.
- Choose the unit preference from the dropdown: "Auto (detect from listing)," "Metric (kg, g, L, ml)," or "Imperial (lb, oz, sq ft)."
- Click "Scan listings" to manually re-scan the current page for listings.
The price per unit appears below the listing price on each Marketplace listing card. For example, if a 12-pack costs $24, you'll see "$2.00 per pack" displayed.
TECHNICAL SECTION — REAL MECHANISM
The script detects Marketplace pages by checking the URL for /marketplace/, /commerce/, /buy/, or /sell/. It finds listing elements using Facebook's class names like .x1n2onr6 and .x1ja2u2z, and selects elements that contain price information (text with $ and sufficient length). The price is extracted using a regex that matches currency amounts. Quantity and unit information is extracted by scanning the listing text for patterns like (\d+)\s*[-–]?\s*(pack|pk|packs), (\d+)\s*(?:-)?\s*(box|case), (\d+)\s*(each|ea|item), (\d+)\s*(?:per\s*)?(pound|lbs?|lb), and similar patterns for oz, kg, g, L, ml, and sq ft. The script also handles "per" without a number (e.g., "per pound"). Once the quantity and unit are identified, the price per unit is calculated as totalPrice / quantity. The result is displayed as a green-colored span with the unit price and a smaller info line showing the quantity and unit type. The script uses WeakSet to track processed listings and avoid duplicate work.
THE PANEL
The settings panel is built with BotGentz's BGPanel component. It is draggable via its header, allowing you to reposition it anywhere on the screen. The panel snaps to the left edge by default but can be moved freely. Click the gear emoji to collapse the panel into a small bubble, and click the bubble to expand it again. The panel remembers its position per page session. Press the Escape key to quickly close or minimize the panel. The panel includes a status flash bar that provides visual feedback when settings are changed or actions are performed. All settings save automatically via GM_setValue.
PLEASE NOTE
This script requires the free BotGentz browser extension to run. It does not function as a standalone Chrome extension and does not use chrome.* APIs. Facebook frequently updates its Marketplace interface and class names, which may affect the selectors used to find listings and prices. If the script stops working, please check for updates. The unit detection relies on text patterns in the listing—if the quantity information is not clearly stated, the script may not detect it. The script stores only your preferences via GM_setValue. No data is sent externally—all data is stored locally in your browser. The script never reads or writes password fields, hidden inputs, or file inputs. All DOM operations use safe methods (style properties, textContent, appendChild) and never use innerHTML.