| 开发者 | manzurahammed |
|---|---|
| 更新时间 | 2026年11月22日 04:12 |
| PHP版本: | 7.4 及以上 |
| WordPress版本: | 7.1 |
| 版权: | GPL-2.0-or-later |
| 版权网址: | 版权信息 |
bogofy folder to the /wp-content/plugins/ directory, or install it from the Plugins screen in WordPress.Yes. WooCommerce must be installed and active for the plugin to work.
Yes. Both simple and variable products are supported as trigger and gift products.
No. When the cart qualifies, the free item is added and priced at zero automatically.
Use the "Enable plugin" toggle on the Settings screen to switch all BOGO functionality off without deleting your rules.
Yes. Since 2.2.0 Bogofy provides these hooks:
bogofy_rule_is_eligible (filter) — ( bool $eligible, Rule $rule, WC_Cart $cart ). Return false to veto a rule for the cart (its gifts are removed and it discounts nothing) or true to force it.bogofy_free_quantity (filter) — ( int $qty, Rule $rule, array $eligible_items ). Change how many free units a rule grants. Applied after the rule's maximum; negative values become 0.bogofy_gift_added (action) — ( string $cart_item_key, int $product_id, int $quantity, Rule $rule ). Fires when Bogofy adds a new gift line. $product_id is the variation ID for a variation.bogofy_gift_removed (action) — ( string $cart_item_key, int $rule_id ). Fires when Bogofy removes a gift line.add_filter( 'bogofy_rule_is_eligible', function ( $eligible, $rule ) { return 12 === (int) $rule->id ? $eligible && is_user_logged_in() : $eligible; }, 10, 2 );
bogofy_rule_is_eligible, bogofy_free_quantity, bogofy_gift_added and bogofy_gift_removed. See the FAQ.EligibilityCheckerInterface gains meets_cart_minimums(), is_product_excluded() and get_next_unlock(), and is_product_eligible() gains an optional $product parameter. DiscountApplierInterface gains switch_gift(). FreeItemManagerInterface gains can_supply(), and add_free_item() gains an optional $replacing parameter. Third-party implementations must add them.conditions column, added automatically on update. Existing rules have no conditions and work as before.FreeItemManagerInterface::add_free_item() gains an optional $variation parameter.FreeItemManagerInterface::cleanup_orphaned_items() and CartHandler::on_cart_item_removed().