Created
September 10, 2015 21:38
-
-
Save growdev/5a6c2582807fcf4575ac to your computer and use it in GitHub Desktop.
Get Product Discounted Price
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// add qty to cart to trigger dynamic pricing | |
$cart_item_key = WC()->cart->add_to_cart('8','300'); | |
$product = wc_get_product( '8' ); | |
echo "NAME: " . $product->get_title() . "\n"; | |
$price = $product->get_price(); | |
echo "PRICE: " . $price . "\n"; | |
/* | |
Currently this is output: | |
NAME: Dinosaur Shirt | |
PRICE: 10 | |
Expecting price to drop to 4.5 | |
*/ | |
// remove qty from cart | |
WC()->cart->remove_cart_item( $cart_item_key ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
@lucasstark

It's a simple product with some quantity price changes:
I'm not sure if that's an advanced or simple rule.
Yes, exactly that.