Website Building » WooCommerce » How Do I Change the Price of WooCommerce Function in PHP?

How Do I Change the Price of WooCommerce Function in PHP?

Last updated on October 1, 2022 @ 5:20 am

If you want to change the price of a product in your WooCommerce store, there are two different ways you can do this. The first way is by using the WooCommerce admin panel, and the second way is by editing the price directly in the code.

To change the price of a product in the WooCommerce admin panel:

1. Log in to your WordPress site and go to your Dashboard. 2. Hover over the WooCommerce tab and click on Products. 3. Find the product you want to edit, and click on Edit. 4. Scroll down to Product Data and find the Regular Price field. 5. Enter the new price for your product, and then click Update.

To change the price of a product by editing the code:

1. Scroll down to Product Data and find the SKU field. Copy the SKU code for your product. Go to your theme folder > WooCommerce > single-product > price.php and open it in a text editor like Notepad++ or Sublime Text.

In this file, you will need to find where it says:

get_price_html(); ?>

Replace that line of code with this:

get_price()); ?>

(You will need to replace “$product->get_price();” with your product’s SKU code.)

.

After you save that file, you will need to upload it back to your server.

.

Conclusion:

.

Changing the price of a product in WooCommerce is easy to do, whether you edit the price directly in the code or through the WooCommerce admin panel.

.

Dale Leydon

Dale Leydon

Sysadmin turned Javascript developer. Owner of 20+ apps graveyard, and a couple of successful ones.