Home » Categories » WordPress

حذف قیمت از محصولات ناموجود در ووکامرس

تم کودک خود را در منوی کشویی فعال کنید ( اگر هم تم کودک ایجاد نکرده اید روی همان قالب اصلی را بمانید) و function.php را انتخاب کنید.

 

add_filter( 'woocommerce_get_price_html', 'woocommerceir_hide_price_if_out_stock_frontend', 9999, 2 );
 
function woocommerceir_hide_price_if_out_stock_frontend( $price, $product ) {
   if ( is_admin() ) return $price; // BAIL IF BACKEND
   if ( ! $product->is_in_stock() ) {
      $price = apply_filters( 'woocommerce_empty_price_html', 'ناموجود', $product );
   }
   return $price;
}
Article Rating (No Votes)
Rate this article
  • Icon PDFExport to PDF
  • Icon MS-WordExport to MS Word
 
Attachments Attachments
There are no attachments for this article.
Comments Comments
There are no comments for this article. Be the first to post a comment.
Related Articles RSS Feed
Wordpress random 500 internal server error
Viewed 415 times since Tue, Mar 1, 2022
Sorry, you are not allowed to access this page.
Viewed 802 times since Wed, Dec 1, 2021
How to export a specific page in Elementor?
Viewed 480 times since Sat, Feb 26, 2022
Link to registration page in Wordpress
Viewed 77 times since Thu, Jun 12, 2025
اجرای درخواست stats.wp.com/w.js
Viewed 936 times since Sat, Feb 12, 2022
How to Add an Admin User to the WordPress Database via MySQL
Viewed 716 times since Thu, Dec 8, 2022