Linux 软件免费装
Banner图

Food Products for WooCommerce

开发者 macvej
更新时间 2026年10月27日 02:33
PHP版本: 7.4 及以上
WordPress版本: 7.1
版权: GPLv2 or later
版权网址: 版权信息

标签

woocommerce food nutrition expiry date batch tracking

下载

2.1.1 1.4.2 1.3.0 1.1.0 1.1.1 1.2.0 1.3.1

详情介绍:

Food Products for WooCommerce turns your WooCommerce shop into a food shop. It adds two new product types - Simple food product and Variable food product - that work exactly like WooCommerce's own Simple and Variable products, with everything a food or grocery shop needs on top: a nutrition declaration table, expiry dates, batch and supplier tracking, and automatic handling of stock that is about to go off. Nothing is replaced or overridden: your existing products, themes and payment gateways carry on untouched. You choose the new product type only on the products that need it. Nutrition declaration table Every food product gets a Nutrition tab: a label/amount/unit table declared per 100 g or per 100 ml (pre-filled with the EU-mandatory energy / fat / carbohydrate / protein / salt rows, all editable) that is shown to shoppers as its own tab on the product page. Rows can be reordered, renamed, indented as sub-nutrients, added and removed. Variable food products can share one table across every variation, or let a single variation override it with its own. Ingredient list An Ingredients tab holding the ingredients in declaration order, each with an optional percentage, sub-ingredients and one of the 14 EU-declarable allergens. The product page prints the list as one sentence with allergens in bold, plus a "may contain" line. Per-variation overrides work the same way as for nutrition. Expiry dates and batch tracking The Expiry & Tracking tab stores one row per batch, each with an expiry date, quantity, batch number, batch date and supplier - so you always know which delivery a unit of stock came from and when it goes off. Variable food products track batches per variation, matching how WooCommerce already tracks stock. A full-price sale takes units off the freshest batch first, a reduced sale takes them off the batch the shopper picked, and a restocking refund puts them back, so the table reads as what is still on the shelf. Optionally, the closest upcoming expiry date is shown to shoppers on the product page - always, or only once it falls within a number of days you choose. Expiry Dashboard and write-off An admin screen listing every batch row across every food product in one place, sorted by closest expiry date first, colour-coded by urgency, filterable by date range and exportable as a CSV file for your stock takes and audits. A batch that has expired can be written off from there or from the product itself, taking what is left of it out of the sellable stock - or you can have that happen automatically every night at an hour you choose. The batch table is the stock Once a product tracks batches, its batch table is its stock. WooCommerce's own stock management is switched off for it while it tracks; the product is in stock while a batch in date has units left, "N in stock" on the product page is the batch total, and a shopper cannot buy more than the batches hold. Every sale comes off a batch - a full-price sale off the freshest batch first, so the batch nearest its date is kept for the reduced offer - and a restocking refund puts the units back. Stock past its best-before date is not sold at all unless you say so (see below). Switch tracking off on a product, change it to a non-food type, or turn Expiry & Tracking off in the settings, and WooCommerce's stock management comes back as it was before - with the batch total as its stock quantity, since every sale in between came off the batches. Automatic Markdown Offer a discount on batches close to their date, on a ladder of steps you set (for example 15% a week out, 30% three days out, 50% on the last day). The product's own price is never changed: the shopper opts into a reduced batch on the product page, choosing the date they want, the discount applies to that cart line only, and an offer withdraws itself once its batch is sold out or expired. A cap on units per batch, a price floor, a catalogue badge and a choice of whether a product with nothing left to sell stays listed or is hidden are all yours to set, and any product can opt out. Where the law allows it, you can also choose to keep selling batches past their best-before date: that adds a fixed last step to the ladder with its own discount and wording, and those units count as sellable stock. A Markdown Earnings screen reports what each marked-down batch sold, what it brought in, what the discount cost, and how much expired unsold anyway. Sell-through is worked out from your current settings, so changing an opt-out, the category scope, the ladder or expired sales later also changes the figures of past batches. Email when expired A scheduled digest email listing every batch that has reached its expiry date - or is about to, within a window you choose - sent to the shop users you pick, daily, weekly, every 2 weeks or every 3 weeks. Each batch is mailed once to each recipient, every send is recorded in an Email Log, and a "Send one now" button lets you run it on demand. Individual products can opt out. Automatic category switching Have WooCommerce move stock for you: categories you choose (for example "Clearance" or "Last chance") are added to a product as it nears its closest expiry date, and categories are removed Built for real shops Requirements WooCommerce 10.0 or later must be installed and active. The plugin will not activate without it. If WooCommerce is later disabled: on a single site, the plugin deactivates itself with an explanatory notice the next time an administrator opens wp-admin; on a network activation the plugin stays active and shows a notice on sites without WooCommerce, where its features stay off. MySQL 5.7 or later, or MariaDB 10.0.2 or later, is also required - the stock locks nest named locks.

安装:

  1. Install and activate WooCommerce, if it isn't already. This plugin adds product types to WooCommerce and will refuse to activate without it.
  2. Install this plugin. Either upload the plugin's zip file under Plugins > Add New > Upload Plugin, or upload the extracted folder to /wp-content/plugins/ over FTP/SFTP, then activate it.
  3. Create a product the normal WooCommerce way (Products > Add New), and choose Simple food product or Variable food product from the Product data type dropdown.
  4. Open Food Products > Settings in the wp-admin menu to configure the date format, expiry email notifications, the Expiry Dashboard and automatic category switching.

屏幕截图:

  • The Nutrition tab in the product editor: the label/amount/unit table declared per 100 g or
  • The Ingredients tab: ingredients in declaration order, each with an optional percentage,
  • The Expiry & Tracking tab: the batch table with expiry date, quantity, batch number and
  • The Automatic Markdown settings, where you set the discount steps that reduce a batch as its
  • The Markdown Earnings dashboard, showing what marked-down stock sold for against what it
  • The Expiry Dashboard: every batch row from every food product in one list, closest expiry

升级注意事项:

2.1.1 Fixes stock hand-back, checkout claims and refund handling in more cases, keeps category settings when a category slug is edited, and tightens security and accessibility. Recommended for every site. 2.1.0 Refunded orders now restock only units you tick to restock, Markdown Earnings revenue is net of refunds, and the expiry digest tracks delivery per recipient. Also improves Variable food products, batch stock, exports and translations. Tested with WooCommerce 11.2. 1.4.2 Fixes translations not loading in the ingredient and product-type editors. 1.4.1 Adds translations for 25 languages. 1.4.0 Requires WooCommerce 10.0. Fixes a product save that could undo sales, stock left stranded when switching batch tracking off, and unpaid orders holding batch units indefinitely. 1.3.1 Fixes expiry, markdown and reporting edge cases. Where Automatic Markdown can discount a batch, its best-before date now appears on the offer instead of above the quantity box. Everywhere else the date shows as before. 1.3.0 Fixes a race that let two simultaneous checkouts oversell the same batch - worth taking if you have any traffic. One behaviour change: refunds now only restock when you tick "Restock refunded items". Existing refunds are unaffected. 1.2.0 New Appearance tab for recolouring what the plugin prints on the shop front; every short-dated batch is now offered, not only the closest one; sortable Expiry Dashboard; theme-neutral product page styling. Nothing you have set up changes. 1.1.0 Automatic Markdown, ingredient lists, expired-batch write-off and two new reporting screens, plus a new Products settings tab. Everything already saved on your products is kept. 1.0.2 Plugin display name now matches the assigned slug. Nothing you have set up changes. 1.0.1 Naming, escaping and reliability fixes from the plugin review. No settings change. 1.0.0 Initial release.

常见问题:

Does this require WooCommerce?

Yes. The plugin adds WooCommerce product types and will not activate without it.

Does it work with my existing products?

Yes. Existing Simple and Variable products are left exactly as they are. The food features appear only on products you switch to Simple food product or Variable food product, and you can switch a product back at any time.

How do I add a nutrition table to a WooCommerce product?

Switch the product to Simple food product or Variable food product from the Product data type dropdown, then fill in its Nutrition tab. It's pre-filled with the EU-mandatory energy, fat, carbohydrate, protein and salt rows, declared per 100 g or per 100 ml, and shown to shoppers as its own tab on the product page.

How do I show allergens in bold on a WooCommerce product?

Once a product is a Simple food product or Variable food product, its Ingredients tab lets you mark any ingredient as one of the 14 EU-declarable allergens. The product page prints the ingredient list as one sentence with those allergens in bold, plus a "may contain" line.

Can I show a best-before date on the product page?

Yes. Turn on "Show expiry date in shop" on the product's Expiry & Tracking tab - always, or only once the date falls within a number of days you choose.

Can I automatically discount food that is about to expire?

Yes, with Automatic Markdown. Set a ladder of discount steps (for example 15% a week out, 30% three days out) and the shopper is offered every batch close enough to its date, each at its own step's price, on the product page; an offer withdraws itself once its batch is sold out or expired.

Can I track expiry dates per variation?

Yes. Variable food products keep their own batch table per variation, since expiry dates and quantities are physical stock facts and WooCommerce already tracks stock per variation. Nutrients work the other way round: one shared table for the whole product, which any single variation can override.

Why does a new Variable food product show its variations straight away?

WooCommerce's newer variations editor doesn't know what type a product is until after it has been saved once, so a Variable food product created with it would show no variation controls at all on first use. This plugin switches WooCommerce back to its classic variations editor on the Add new product screen, whatever product type you end up creating, and on every product already saved as a Simple food product or Variable food product, so a Variable food product works from the moment you create it and stays that way. Every other product screen keeps WooCommerce's own choice of editor untouched.

What is the Expiry Dashboard?

An admin screen listing every batch row from every food product's Expiry & Tracking table in one place, sorted by closest expiry date first, filterable by date range and exportable as CSV. It can be turned off on the Settings page.

Can I get emailed when a product expires?

Yes. Turn on "Send the expiry digest email" on the Notification Email tab and choose recipients and a frequency (daily, weekly, every 2 weeks or every 3 weeks). Each expiring batch row is emailed once to each recipient and logged. Set an "upcoming expiry window" to be warned a few days ahead instead of only after the fact.

Does the plugin call any external service?

No. It makes no remote requests, requires no account or API key, and collects no analytics or telemetry.

Does Automatic Markdown work with the block-based product page?

The reduced-batch choice is a field in WooCommerce's classic add-to-cart form, so it appears on the classic single product template and in the Add to Cart form block that renders that form. The Cart, Mini Cart and Checkout blocks all show the batch and offer a reduced line was bought under.

Do the food product types work with block themes and the Store API?

Simple food products and Variable food products use WooCommerce's classic add-to-cart forms, so on the classic single product template they work like WooCommerce's own Simple and Variable products. In a block theme the Add to Cart with Options block shows that same classic form for both food types, with the block's quantity steppers. It does not use its own Variation Selector and Quantity Selector blocks or an edited add-to-cart template part for them: WooCommerce picks those by product type for its own types only and offers no stable way for another type to use them. The Store API product data, which the product blocks and headless shops read, lists a Variable food product's variations, its price range and its regular and sale prices the same way as for a Variable product. Its type still reads "fpwc_food_variable", so a Store API product query filtered to the "variable" type does not include it. Some of WooCommerce's block-theme features only know its own Variable type, so for a Variable food product they fall short in a few places:

  • The Product Gallery block only gets a variation's gallery for the "variable" type, so the parent's images stay on screen after a shopper picks a variation.
  • The Price, Stock Indicator and SKU blocks keep showing the parent product's values after a variation is chosen, because they follow the choice made in WooCommerce's own Variation Selector block, which a food product's classic form does not use. The classic single product template shows the variation's own price, stock and SKU.
  • The experimental Wishlist block (the Add to Wishlist button, behind WooCommerce's "product_wishlist" feature, which is off by default) does not support Variable food products.
Simple food products are not affected. Separately, keep WooCommerce's "Optimized updates" setting switched off (WooCommerce > Settings > Products > Advanced, under "Product attributes lookup table", shown once that table exists). With it on, WooCommerce writes variation rows to the lookup table for the "variable" type only: a Variable food product goes in as one product carrying all its attribute values, so a sold-out variation is not reflected when shoppers filter by attribute. WooCommerce's back-in-stock notification signup form is not shown for Simple food products or Variable food products, so customers cannot subscribe to be told when one is back in stock: the form only appears for WooCommerce's own Simple and Variable product types.

Can I move food products with WooCommerce's CSV export and import?

Yes. WooCommerce's product CSV export lists both food product types and their variations, and carries a Variable food product's default attributes, which its import reads back. Export Variable food products without a category filter and without picking individual products: WooCommerce adds the variation rows to such a filtered export only for its own Variable products, so a Variable food product would be exported without its variations. Import new variations of a Variable food product with "Update existing products" off: with it on, WooCommerce creates a new variation only under its own Variable products and skips the row.

What happens to the batch units held by an order that never pays?

Starting checkout claims the batch units in the cart so two shoppers cannot both buy the last one. If the order is never paid, those units are put back automatically once WooCommerce's own "Hold stock (minutes)" setting (WooCommerce > Settings > Products > Inventory) has passed, no matter how the order was started. When that setting is left empty, 60 minutes is used instead. You don't need to cancel the order by hand to free the stock. Nothing is released while a product's Expiry & Tracking is switched off.

Will automatic category switching mess up my categories?

No. It records exactly what it added or removed on each product and reverses only that. Any category you assigned by hand is left alone, and individual products can opt out of category switching entirely on their Expiry & Tracking tab. Opting a product out, or turning category switching (or Expiry & Tracking) off, puts back whatever it had changed at that moment.

What happens to my data if I delete the plugin?

Deleting the plugin removes only its own settings (fpwc_generel_settings_options, fpwc_appearance_settings_options), the email log, the category switching log and a note of any stock hand-back still in progress. Nutrition, ingredient and Expiry & Tracking data saved on your products, and the batch a marked-down order line was bought from, are left untouched, so reinstalling picks up exactly where you left off. One thing is worth doing first: deactivating or deleting the plugin does not hand stock back to WooCommerce by itself. Turn Expiry & Tracking off in the settings before you remove the plugin, and every tracked product gets WooCommerce's "Manage stock" back with its batch total as the stock quantity.

更新日志:

2.1.1 2.1.0 1.4.2 1.4.1 1.4.0 1.3.1 1.3.0 Correctness release. The headline fix is a race condition in how batch stock was written. 1.2.0 1.1.0 1.0.2 1.0.1 1.0.0