
內容簡介
總結:這個外掛讓你可以限制 WooCommerce 優惠券的使用,除非特定產品在購物車中。你可以指定哪些產品是必需的,以使優惠券有效,讓你更有控制權管理折扣策略。
問題與答案:
1. 這個外掛的主要功能是什麼?
- 限制優惠券使用,除非購物車中有特定產品。
2. 如何自訂錯誤訊息?
- 透過過濾器 `runthings_wc_coupons_required_products_error_message`。
3. 在哪裡可以找到更詳細的文件和進階範例?
- 可以在 GitHub 上查看完整的文件說明。
4. 這個外掛是以什麼授權方式提供的?
- 根據 GNU 通用公共授權條款的第 3 版或任何稍後的版本提供,可以自由重新分發和修改。
5. 如何知道外掛的授權詳情?
- 應該已經收到 GNU 通用公共授權條款的副本,如果沒有,可以在 http://www.gnu.org/licenses/gpl-3.0.html 查看。
6. 外掛使用到的圖示來源是哪裡?
- "Discount" 圖示由 Gregor Cresnar 設計,"restriction" 圖示由 Puspito 設計,來自 Noun Project,使用 CC BY 3.0 授權。
外掛標籤
開發者團隊
② 後台搜尋「Required Products Coupons for WooCommerce」→ 直接安裝(推薦)
原文外掛簡介
This plugin allows you to restrict the usage of WooCommerce coupons unless specific products or variations are in the cart.
You can specify which products are required for a coupon to be valid, providing more control over your discount strategies.
Features
Restrict coupon usage based on all required products (including variations) being in the cart.
Customize the error message via a filter.
Filters
runthings_wc_coupons_required_products_missing_products
This filter allows third-party plugins to alter the missing required products before the coupon is rejected.
For detailed documentation and advanced examples, see the full documentation on GitHub.
Parameters:
$missing_products (array): The missing products in the cart, in the format [product_id => quantity].
$coupon (WC_Coupon): The coupon object being validated.
$required_products (array): The required products for the coupon, in the format [product_id => quantity].
$cart_products (array): Products found in the cart, in the format [product_id => quantity].
$cart (WC_Cart): The cart instance.
runthings_wc_coupons_required_products_error_message
This filter allows customization of the error message shown when a coupon is not valid due to missing required products.
For detailed documentation and advanced examples, see the full documentation on GitHub.
Parameters:
$message (string): The default error message, e.g., "This coupon requires specific products in the cart.".
$coupon (WC_Coupon): The coupon object being validated.
$required_products (array): The required products for the coupon, in the format [product_id => quantity].
$missing_products (array): The missing products in the cart, in the format [product_id => quantity].
License
This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with this program; if not, see http://www.gnu.org/licenses/gpl-3.0.html.
Icon – Discount by Gregor Cresnar, from Noun Project, https://thenounproject.com/browse/icons/term/discount/ (CC BY 3.0)
Icon – restriction by Puspito, from Noun Project, https://thenounproject.com/browse/icons/term/restriction/ (CC BY 3.0)
