If you have a WordPress site and are interested in selling anything, WooCommerce is most likely the way to go. Powered by Automattic, it is by far the most popular e-commerce plugin available for WordPress. It is supported by a very large community and it’s extended with themes and plugins by many third party authors. Having established WooCommerce is pretty much a necessity when you need to sell something via a WordPress site, it stands to reason that there are some things it can’t do, not out of the box anyway.
In our example we’d like to display per-product restock notices, to let our customers know when an out of stock product will be available for purchase. Lucky for us WooCommerce is extendable and we can achieve the desired outcome with just a few lines of code. Let’s begin.
Our goal
We are going to add a restock notice field in the Inventory section of the product’s data, as displayed below.
In this field we can add a piece of text informing our customers when the product will be back in stock. The line will be displayed below the out of stock notice, as seen in the following image.
Creating the plugin file
Let’s create the main file that
Source: https://managewp.org/articles/17538/add-and-display-a-custom-field-on-woocommerce
source https://williechiu40.wordpress.com/2018/06/20/add-and-display-a-custom-field-on-woocommerce/
No comments:
Post a Comment