Skip to content

89CF/additional-products

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

22 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

WooCommerce Gift Products

A lightweight WooCommerce plugin that automatically adds free gift products to the cart when a configured product is purchased. Set up gift rules per product from the product edit screen, and the plugin handles the rest: adding the gift, pricing it at zero, keeping it in sync with its parent, and displaying it to shoppers.

WordPress WooCommerce PHP License

Features

  • Per-product gift rules — pick one or more gift products for any simple product from a searchable select box on the product edit screen (product metabox with AJAX search).
  • Automatic cart handling — when a product with configured gifts is added to the cart, its gift products are added automatically and priced at 0.
  • Stock-aware — gifts that are out of stock or unpublished are skipped, with a cart notice shown to the customer when a gift can't be added.
  • Parent/child sync — removing the main product from the cart removes its associated gifts; gifts are re-validated when the cart is restored from session so orphaned gifts don't linger.
  • Gift protection — gift line items can't have their quantity changed and their remove link is hidden, so customers can't manipulate them directly.
  • Frontend display
    • A "free gift with this product" box on the single product page.
    • A gift badge/label on cart line items showing which parent product the gift came with.
    • A gift-count badge with thumbnails on shop/catalog/archive pages for products that include gifts.
  • HPOS and Cart/Checkout Blocks compatible — declares compatibility with WooCommerce's custom order tables and block-based cart/checkout.
  • Translation ready — text domain wc-gift-products, with Turkish (tr_TR) and English (en_US) translations included.

Requirements

  • WordPress 5.0+
  • WooCommerce 3.0+ (tested up to 8.0)
  • PHP 7.2+

Installation

  1. Download or clone this repository.
  2. Upload the plugin folder to /wp-content/plugins/wc-gift-products, or zip it and install through Plugins → Add New → Upload Plugin in wp-admin.
  3. Activate the plugin through the Plugins menu in WordPress.
  4. Make sure WooCommerce is installed and active — the plugin will show an admin notice and stay inactive otherwise.

Configuration

Open any simple product for editing in wp-admin. In the 🎁 Gift Products metabox (sidebar), search for and select the product(s) that should be given away for free whenever this product is added to the cart, then update/publish the product. No global settings page is needed — everything is configured per product.

Translations

The plugin ships with:

  • Turkish (tr_TR) — languages/wc-gift-products-tr_TR.po
  • English (en_US) — languages/wc-gift-products-en_US.po

A languages/wc-gift-products.pot template is included for adding new languages. To contribute a translation, copy the .pot file to wc-gift-products-{locale}.po, translate the strings, and compile a .mo file (e.g. with msgfmt or Poedit) before submitting a pull request.

Contributing

Issues and pull requests are welcome. Please keep changes focused and consistent with the existing code style (WordPress PHP coding standards), and wrap any new user-facing strings for translation.

License

MIT — see LICENSE for details.

About

WooCommerce plugin that adds gift/complementary products to orders based on configurable rules.

Topics

Resources

License

Stars

1 star

Watchers

0 watching

Forks

Releases

No releases published

Packages

 
 
 

Contributors