I have a product in WooCommerece that has a display and base price. The following code is used:
global $woocommerce;
foreach ( $woocommerce->cart->get_cart() as $cart_item_key => $cart_item ) {
$productID = $cart_item['product_id'];
break; //Take the first as an example
}
$product = new WC_Product($productID);
$base_price= $product->get_price();
$display_price = $product->get_display_price();
My issue is, the base and display price come back as the same value but they are maintained differently in the back end.
Update: Tax Settings
I understand this issue may be related to Tax settings. Here are mine:
- Taxes Enabled
- Prices entered inclusive of tax
- Calculate tax based on shop address
- Shipping tax class based on cart items
- No rounding
- No additional tax classes
- Display prices in shop excluding tax
- Display prices in cart / checkout excluding tax
- No suffix
- Display tax totals as itemised
There is also a blanket standard rate which is zero-rate.
And for the Product:
- Taxable
- Tax Class is Standard
Update
The issue stems from the fact I am using the WooCommerence Booking plugin. To get the base price of a booking:
global $woocommerce;
foreach ( $woocommerce->cart->get_cart() as $cart_item_key => $cart_item ) {
$productID = $cart_item['product_id'];
break;//Take the first as an example
}
$product = new WC_Product($productID);
$admission = $product->wc_booking_cost;