Load XML prices into PHP
-
Because I want to change the display product price of each product (not the real price). I have used following code in my functions.php:
function sv_change_product_html( $price_html, $product ) { if ( 66 === $product->id ) { $price_html = '<span class="amount">€10.00</span>'; } return $price_html; } add_filter( 'woocommerce_get_price_html', 'sv_change_product_html', 10, 2 );
The code above is only for product ID 66, but I need to write this code for every product. I can easily do this but everytime I want to change the display product price I need to change it in the functions.php and I don’t want that.
How can I make a XML file with all the display product prices and load them into my functions.php so I dont have to write all the prices in the PHP file but I can easily load them from a XML list.
Hope someone can help.
Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
- The topic ‘Load XML prices into PHP’ is closed to new replies.