iamehsan56 0 ارسال شده در مهر 99 گزارش بازنشر ارسال شده در مهر 99 hh اbegin remove shipping method from some product category */ /***************************************************************/ /* add_filter( 'woocommerce_package_rates', 'specific_products_shipping_methods', 10, 2 ); function specific_products_shipping_methods( $rates, $package ) { // HERE set the product category in the array (ID, slug or name) $terms = array( 'np' ); $taxonomy = 'product_tag'; // HERE set the shipping methods to be removed (like "fat_rate:5") $method_instances_ids = array(11); $found = false; // Loop through cart items checking for defined product IDs foreach( $package['contents'] as $cart_item ) { if ( has_term( $terms, $taxonomy, $cart_item['product_id'] ) ){ $found = true; break; } } if ( ! $found ) return $rates; // If not found we exit // Loop through your active shipping methods foreach( $rates as $rate_id => $rate ) { // Remove all other shipping methods other than your defined shipping method if ( in_array( $rate_id, $method_instances_ids ) ){ unset( $rates[$rate_id] ); } } return $rates; } */ /** End remove shipping method from some product category */ /* سلام من برای اینکه بتونم ازیه دسته از محصولات تو ووکامرس بعضی روشهای حمل و نقل رو حذف کنم از کد بالا استفاده کردم و تو functions اوردمش اما کار نمی کنه . کسی می تونه کمک کنه . شماره کتگوری رو از صفحه دسته بندی ها دراوردم و instance id روش حمل ونقل رو هم از تو صفحه حمل و نقل در اوردم لینک به ارسال
asadiy4n 2805 ارسال شده در مهر 99 گزارش بازنشر ارسال شده در مهر 99 سلام به انجمن خوش آمدید نیاز به ارسال تایپیک تکراری نیست درصورتی که کسی آشنایی داشته باشه پاسخ میدن بهتون 1 لینک به ارسال
پست های پیشنهاد شده