Update WooCommerce product prices to match Comparison Set prices
The following code will update your WooCommerce products' prices with the lowest price and highest price found in a product's Comparison Set.
Important
This code will only update a WooCommerce product's price when the Comparison Set is created or updated. Therefore, if you add this code to your site, you may need to wait a period of time (see WordPress Admin Area > Datafeedr API > Comparison Sets > Cache Lifetime) before your product prices start to get updated.
- 1
-
Create a custom plugin
If you haven't done so already, create a custom plugin.
- 2
-
Add code
Add the following code to your custom plugin:
- 3
-
Save
Save your changes.
Now after your Comparison Sets begin updating (or when they are created), your WooCommerce product prices will be updated.