Programmatically getting product price including addons
-
I’m writing a function to alter prices based on user role using the “woocommerce_product_get_price” hook. In the function I grab the product price by using:
$product->get_regular_price();
Unfortunetly this just grabs the base price of the product. So after adding a product to cart with price-altering addons applied, only the base prices without the addon costs are implemented.
What can I use instead of get_regular_price() to get the product cost after addons are applied? If there is no function to return the whole price, then how I can accomplish $product->get_regular_price() + *get addon costs* on the cart and checkout pages?
I know to use if(is_cart()) and if(is_checkout()).
- The topic ‘Programmatically getting product price including addons’ is closed to new replies.