/** * Disallow point redemption if cart has subscription product. */ add_filter(‘lpfw_checkout_show_redeem_form’, function($value) { // check if cart has subscription product $cart = WC()->cart->get_cart_contents(); foreach ( $cart as $cart_item ) { $product = $cart_item[‘data’]; // disallow store credits if cart…Continue reading
/** * Disallow store credits if cart has subscription product. */ add_filter(‘acfw_is_allow_store_credits’, function($value) { // check if cart has subscription product $cart = WC()->cart->get_cart_contents(); foreach ( $cart as $cart_item ) { $product = $cart_item[‘data’]; // disallow store credits if cart…Continue reading
/** * Generate a virtual coupon when order is completed. * * @param int $order_id Order ID. */ function acfwp_create_virtual_coupon( $order_id ) { $order = wc_get_order( $order_id ); $customer_id = $order->get_customer_id(); $create_date = date( ‘Y-m-d H:i:s’, current_time(‘timestamp’)); $expire_date = date(…Continue reading
/** * Generate a virtual coupon when order is completed. * * @param int $order_id Order ID. */ function acfwp_create_virtual_coupon( $order_id ) { $order = wc_get_order( $order_id ); $customer_id = $order->get_customer_id(); $create_date = date( ‘Y-m-d H:i:s’, current_time(‘timestamp’)); $expire_date = date(…Continue reading
add_filter( ‘acfw_product_search_allowed_types’ , ‘acfw_search_add_support_for_subscription_products’ ); function acfw_search_add_support_for_subscription_products( $product_types ) { $product_types[] = ‘subscription’; $product_types[] = ‘variable-subscription’; $product_types[] = ‘subscription_variation’; return $product_types; }Continue reading
add_filter(‘wwp_filter_wholesale_price_title_text’, ‘wholesale_price_text’, 10, 1); function wholesale_price_text($text) { global $wc_wholesale_prices; $user_wholesale_role = $wc_wholesale_prices->wwp_wholesale_roles->getUserWholesaleRole(); if (!empty($user_wholesale_role)) { // To Switch wholesale price text depending on wholesale role switch ($user_wholesale_role[0]) { case ‘wholesale_customer’: return ‘Wholesale Price:’; // Add more role keys case ‘wholesale_bronze’:…Continue reading
// Prevent wholesale customer to add to cart if the product is low on stock add_filter(‘woocommerce_is_purchasable’, ‘wwpp_disable_cart_lowstock’, 10, 2 ); add_filter(‘woocommerce_variation_is_purchasable’, ‘wwpp_disable_cart_lowstock’, 10, 2 ); function wwpp_disable_cart_lowstock( $purchasable, $product ) { global $wc_wholesale_prices_premium; $user_wholesale_role = $wc_wholesale_prices_premium->wwpp_wholesale_roles->getUserWholesaleRole(); if( !empty( $user_wholesale_role )…Continue reading
function custom_validate_coupon( $errors ) { global $wpdb; //If user is not logged in, then they’ve never used a coupon before if( !MeprUtils::is_user_logged_in() ) { return $errors; } $coupon_code = ( isset( $_POST[‘mepr_coupon_code’] ) && !empty( $_POST[‘mepr_coupon_code’] ) )?stripslashes( $_POST[‘mepr_coupon_code’] ):”;…Continue reading