Replace Woocommerce “add to cart” to be “Download” button [closed]
hook into the woocommerce hook is_purchasable add_filter(“woocommerce_is_purchasable”, function($product, $isPurchasable) { if(!$isPurchasable) return $isPurchasable; $productId = $product->get_id(); $user = wp_get_current_user(); if($user->exists() && $productId == 769) { $userId = $user->ID; $userEmail = $user->user_email; if(wc_customer_bought_product($userEmail, $userId, $productId)) { //block the purchase so the user sees read more instead of add to cart $isPurchasable = false; } } return … Read more