🚀 Is building a website too difficult? Let me guide you step by step—Learn about the 「Naibabiji WordPress Website Building Coaching Service」 →

WooCommerce Product Stock Settings and Methods to Display Stock Quantity

WeForeign Trade Website BuildingWhen building a foreign trade independent website, WooCommerce is typically used to sell products. Since sales are involved, stock information becomes necessary. This article by Naiba introduces how to set product stock in WooCommerce and how to display the stock quantity on the product purchase page.

How to Set Stock

WooCommerce库存管理设置First, go to the Admin Dashboard, find WooCommerce settings, switch to the product settings page, and locate the stock settings. Check 'Enable stock management', then set the 'Hold stock (minutes)' and save the settings.WooCommerce库存管理设置Then, go to the product editing page, find the 'Inventory' tab, and check 'Manage stock?'. Fill in the stock quantity below. Once this is done, WooCommerce stock is set up. Next, let's see how to display stock data on the website's product page.

Display Stock Information on Product Page

After setting up the stock, you may also want to display the product stock on the Frontend so users can know the remaining quantity. This can be achieved through either a plugin or code.

Method 1: Using the Woocommerce Show Stock Plugin

WooCommerce库存显示You can directly search for 'Woocommerce Show Stock' in the plugins section of the Admin Dashboard to install it. After installation, go to WooCommerce's stock settings interface. At the bottom, there is a section for stock display settings. Enable stock display, set the display position, and save.Download Link

Method 2: Adding via Code

产品分类页显示库存信息Add the following code snippet to your Theme's functions.php file to display stock information on product archive pages.
add_action( 'woocommerce_after_shop_loop_item', 'bbloomer_show_stock_shop', 10 );

function bbloomer_show_stock_shop() {
global $product;
echo wc_get_stock_html( $product );
}
Source: https://businessbloomer.com/woocommerce-add-stock-quantity-on-shop-page/

🚀 Still feeling confused after reading the tutorial? Let me guide you step-by-step.

「Naibabiji WordPress Website Building Coaching Service」—From choosing a domain and buying hosting, to installing a Theme and publishing content, I「ll coach you through every step, helping you avoid detours and reach your goal directly.

👉 Learn about the Website Building Coaching Service
🔒

Comments are closed

The comment function for this article is closed. If you have any questions, please feel free to contact us through other channels.

×
二维码

Scan QR Code to Follow

AI Website Building Assistant

🤖
Hello! I am the Naibabiji AI Assistant. How can I help you?
Quick Consultation: