armimo98 0 ارسال شده در دی 00 گزارش بازنشر ارسال شده در دی 00 سلام خدمت دوستان گرامی من برای سایتم که یک سایت چند فروشندگی با ووکامرس و دکان است به مشکل خورده ام اول در خرید اجازه خرید به بیش از یک فروشنده را نمی داد ولی هر تعداد خرید از فقط یک فروشنده مجاز بود با خطای : <<Sorry, you can't add more than one vendor product in the cart.>> بعد قطعه کد : add_action( 'woocommerce_add_to_cart_validation', function( $is_allow, $product_id, $quantity ) { $product = get_post( $product_id ); $product_author = $product->post_author; //Iterating through each cart item foreach ( WC()->cart->get_cart() as $cart_item_key => $cart_item ) { $cart_product_id = $cart_item['product_id']; $cart_product = get_post( $cart_product_id ); $cart_product_author = $cart_product->post_author; if( $cart_product_author != $product_author ) { $is_allow = false; break; } } if( !$is_allow ){ // We display an error message wc_clear_notices(); wc_add_notice( __( "Well, you already have some item in your cart. First checkout with those and then purchase other items!", "wcfm" ), 'error' ); } return $is_allow; }, 50, 3 ); به فانکشن اضافه کردن حالا پیغام خطا به :<< Well, you already have some item in your cart. First checkout with those and then purchase other items!>> تغییر کرده است و ساختار خرید به همان شکل است که خرید از دو فروشنده صورت نمی پذید ممنون می شم اگر دوستان تجربه ای در این رابطه یا پیشنهادی دارند ارائه دهند Well, you already have some item in your cart. First checkout with those and then purchase other items! Well, you already have some item in your cart. First checkout with those and then purchase other items! نقل قول لینک به ارسال
پست های پیشنهاد شده
به گفتگو بپیوندید
هم اکنون می توانید مطلب خود را ارسال نمایید و بعداً ثبت نام کنید. اگر حساب کاربری دارید، برای ارسال با حساب کاربری خود اکنون وارد شوید .