Need custom Pricing for woocommerce shop page products from functions.php
-
I want to get custom pricing from functions.php. For woocommerce shop page i want the output as follows. I created a custom taxonamy(team), and i am applying a custom price from the backend.
Eg :
- Taxonomy : Team1
- a) Product Id : 17, Price =222; //Original price $45
- b) Product Id : 18, Price = 444;// Original price $55
- Taxonomy : Team2
- a) Product Id : 17, Price =999; //Original price $45
- b)Product Id : 18, Price = 888;// Original price $55
How can i get the my example output by using the following code? If any changes or modification please let me know.
I am using the following code :
add_filter( ‘woocommerce_get_regular_price’, function ($price, $productd ) {
foreach($_SESSION[‘my_array’] as $id => $price1) :$regular_price = get_post_meta(get_the_ID(), ‘_regular_price’);
$price = $regular_price[0];if(get_the_ID() == $id) :
return $price1;
else :return $price;
endif;
endforeach;
}, 10, 2 );
- The topic ‘Need custom Pricing for woocommerce shop page products from functions.php’ is closed to new replies.