我希望客戶只要購物時返回商店頁面就可以從購物中購買一種產品,他們將被重定向到我的帳戶頁面。如何限制客戶使用woocommerce購買一種產品
<?php
/**
* Loop Add to Cart
*
* @author WooThemes
* @package WooCommerce/Templates
* @version 2.1.0
*/
if (! defined('ABSPATH')) exit; // Exit if accessed directly
global $product;
$current_user = wp_get_current_user();
if (wc_customer_bought_product($current_user->user_email, $current_user->ID, $product->id)) {
$redirect = $myaccount;
}
我使用下面的代碼放置在循環文件夾中,但它不工作。
我想,用戶可以在一生 說明一旦購買的產品 - 它不是在同一時間 它就像如果有人購買了該產品,那麼他/她永遠能購買任何其他產品購買一個產品。
選中此[插件](https://wordpress.org/plugins/woocommerce-max-quantity/) – Gunaseelan