WooCommerce购物车 - 动态设置产品价格然后将优惠券应用于新的总计

I'm trying to dynamically set a product price, which I can do just fine. However when I try to apply a coupon that has a minimum spend, the coupon will not apply.

EDIT

The dynamic pricing updates and everything looks good, the apply_coupon just doesn't work when I have a minimum spend on the coupon. It's like it cannot see the newly calculated totals.

Anyone got any ideas?

$coupon_code = 'coupontest';
$cart = new WC_Cart();
$cart->add_to_cart(531, 1);

foreach( $cart->get_cart() as $cart_item ) {
    $cart_item['data']->set_price( (float) 100 );
}

$cart->calculate_totals(); //this works! the prices are calculated correctly

//Minimum spend on the coupon is not met though?
$cart->apply_coupon($coupon_code); //this does not work! 

Thanks!