@@ -447,9 +447,7 @@ public function test_get_line_items_structure() {
447447 }
448448
449449 /**
450- * A pricing filter can empty a price after the item is already in the cart.
451- * wc_format_decimal() passes that through, and a non-numeric unit price is fatal
452- * in the totals arithmetic, so the line is skipped.
450+ * Test that a line emptied by a pricing filter after being added to the cart is skipped.
453451 */
454452 public function test_get_line_items_skips_line_with_non_numeric_price () {
455453 $ this ->product = WC_Helper_Product::create_simple_product ();
@@ -465,10 +463,29 @@ public function test_get_line_items_skips_line_with_non_numeric_price() {
465463 }
466464
467465 /**
468- * A zero price is legitimate and must keep reaching TaxJar, so the guard has to be
469- * is_numeric() and not a truthiness check. See
470- * test_zero_amount_response_persists_real_itemized_rates() for what the response to
471- * a $0 line carries.
466+ * Test that a '-' price is skipped, being truthy and non-empty where '' is neither.
467+ */
468+ public function test_get_line_items_skips_line_with_dash_price () {
469+ $ this ->assertSame ( '- ' , wc_format_decimal ( '- ' ) );
470+
471+ $ this ->product = WC_Helper_Product::create_simple_product ();
472+ $ this ->product ->save ();
473+
474+ WC ()->cart ->add_to_cart ( $ this ->product ->get_id (), 2 );
475+
476+ $ dash_price = function () {
477+ return '- ' ;
478+ };
479+
480+ add_filter ( 'woocommerce_product_get_price ' , $ dash_price );
481+ $ line_items = $ this ->invoke_protected_method ( 'get_line_items ' , array ( WC ()->cart ) );
482+ remove_filter ( 'woocommerce_product_get_price ' , $ dash_price );
483+
484+ $ this ->assertSame ( array (), $ line_items );
485+ }
486+
487+ /**
488+ * Test that a zero price still reaches TaxJar, being falsy but numeric.
472489 */
473490 public function test_get_line_items_keeps_line_priced_zero () {
474491 $ this ->product = WC_Helper_Product::create_simple_product ();
0 commit comments