• Resolved fabiopwl37

    (@fabiopwl37)


    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()).

    • This topic was modified 6 years, 10 months ago by fabiopwl37.
    • This topic was modified 6 years, 10 months ago by fabiopwl37.
    • This topic was modified 6 years, 10 months ago by fabiopwl37.
    • This topic was modified 6 years, 10 months ago by fabiopwl37.
Viewing 1 replies (of 1 total)
  • Hi,

    well price calculation are bit complex, we are calculating prices for different inputs in different ways. Like for matrix or bulk quantity addon etc.

Viewing 1 replies (of 1 total)
  • The topic ‘Programmatically getting product price including addons’ is closed to new replies.