Commit 2fa5b5690cb for woocommerce

commit 2fa5b5690cbb2518e8b607e932d218191847d4d9
Author: James Kemp <me@jckemp.com>
Date:   Mon Jul 13 13:05:51 2026 +0100

    Structured data VAT property (#63287)

    * Add tests for valueAddedTaxIncluded structured data behavior

    Adds unit tests to verify that valueAddedTaxIncluded is conditionally
    included in product and order structured data based on wc_tax_enabled().
    The implementation fix was already merged via #63304.

    https://claude.ai/code/session_017Mwo2ZfL4zQ3Pdnvf8sJ1G

    * Add @testdox annotations to new tests; update changelog to comment type

    * Add changefile(s) from automation for the following project(s): woocommerce

    * Fix changelog type: use dev instead of comment

    * Add changefile(s) from automation for the following project(s): woocommerce

    * Resolve merge conflict: include trunk tests alongside VAT tests

    * Add changefile(s) from automation for the following project(s): woocommerce

    * Update changelog

    ---------

    Co-authored-by: Claude <noreply@anthropic.com>
    Co-authored-by: woocommercebot <woocommercebot@users.noreply.github.com>
    Co-authored-by: Albert Juhé Lluveras <contact@albertjuhe.com>

diff --git a/plugins/woocommerce/changelog/cursor-WOOPLUG-6298-structured-data-vat-property-93ff b/plugins/woocommerce/changelog/cursor-WOOPLUG-6298-structured-data-vat-property-93ff
new file mode 100644
index 00000000000..7ab4ee76062
--- /dev/null
+++ b/plugins/woocommerce/changelog/cursor-WOOPLUG-6298-structured-data-vat-property-93ff
@@ -0,0 +1,5 @@
+Significance: patch
+Type: dev
+Comment: Add tests about `valudAddedTaxIncluded` not being added to structured data when taxes are disabled
+
+
diff --git a/plugins/woocommerce/tests/php/includes/class-wc-structured-data-test.php b/plugins/woocommerce/tests/php/includes/class-wc-structured-data-test.php
index 08b6e3e7a41..48e5828e9f2 100644
--- a/plugins/woocommerce/tests/php/includes/class-wc-structured-data-test.php
+++ b/plugins/woocommerce/tests/php/includes/class-wc-structured-data-test.php
@@ -125,6 +125,163 @@ class WC_Structured_Data_Test extends \WC_Unit_Test_Case {
 		$this->assertEquals( get_woocommerce_currency(), $offer['priceCurrency'] );
 	}

+	/**
+	 * @testdox valueAddedTaxIncluded is present in product structured data when taxes are enabled.
+	 *
+	 * @return void
+	 */
+	public function test_product_structured_data_includes_vat_when_taxes_enabled(): void {
+		// Enable taxes.
+		update_option( 'woocommerce_calc_taxes', 'yes' );
+		update_option( 'woocommerce_tax_display_shop', 'incl' );
+
+		// Create a simple product with a price.
+		$product = WC_Helper_Product::create_simple_product();
+		$product->set_regular_price( 10 );
+		$product->save();
+
+		// Generate structured data.
+		$this->structured_data->generate_product_data( $product );
+		$data = $this->structured_data->get_data();
+
+		// Get the first structured data entry.
+		$this->assertNotEmpty( $data );
+		$product_data = $data[0];
+
+		// Check that offers exist.
+		$this->assertArrayHasKey( 'offers', $product_data );
+		$this->assertNotEmpty( $product_data['offers'] );
+
+		// Get the first offer.
+		$offer = $product_data['offers'][0];
+
+		// Check that priceSpecification exists and contains valueAddedTaxIncluded.
+		$this->assertArrayHasKey( 'priceSpecification', $offer );
+		$this->assertNotEmpty( $offer['priceSpecification'] );
+
+		$price_spec = $offer['priceSpecification'][0];
+		$this->assertArrayHasKey( 'valueAddedTaxIncluded', $price_spec );
+		$this->assertTrue( $price_spec['valueAddedTaxIncluded'] );
+
+		// Clean up.
+		$product->delete( true );
+	}
+
+	/**
+	 * @testdox valueAddedTaxIncluded is not present in product structured data when taxes are disabled.
+	 *
+	 * @return void
+	 */
+	public function test_product_structured_data_excludes_vat_when_taxes_disabled(): void {
+		// Disable taxes.
+		update_option( 'woocommerce_calc_taxes', 'no' );
+
+		// Create a simple product with a price.
+		$product = WC_Helper_Product::create_simple_product();
+		$product->set_regular_price( 10 );
+		$product->save();
+
+		// Generate structured data.
+		$this->structured_data->generate_product_data( $product );
+		$data = $this->structured_data->get_data();
+
+		// Get the first structured data entry.
+		$this->assertNotEmpty( $data );
+		$product_data = $data[0];
+
+		// Check that offers exist.
+		$this->assertArrayHasKey( 'offers', $product_data );
+		$this->assertNotEmpty( $product_data['offers'] );
+
+		// Get the first offer.
+		$offer = $product_data['offers'][0];
+
+		// Check that priceSpecification exists.
+		$this->assertArrayHasKey( 'priceSpecification', $offer );
+		$this->assertNotEmpty( $offer['priceSpecification'] );
+
+		$price_spec = $offer['priceSpecification'][0];
+
+		// valueAddedTaxIncluded should not be present when taxes are disabled.
+		$this->assertArrayNotHasKey( 'valueAddedTaxIncluded', $price_spec );
+
+		// Clean up.
+		$product->delete( true );
+	}
+
+	/**
+	 * @testdox valueAddedTaxIncluded is present in order structured data when taxes are enabled.
+	 *
+	 * @return void
+	 */
+	public function test_order_structured_data_includes_vat_when_taxes_enabled(): void {
+		// Enable taxes with prices inclusive of tax.
+		update_option( 'woocommerce_calc_taxes', 'yes' );
+		update_option( 'woocommerce_prices_include_tax', 'yes' );
+
+		// Create a simple product and order.
+		$product = WC_Helper_Product::create_simple_product();
+		$product->set_regular_price( 10 );
+		$product->save();
+
+		$order = WC_Helper_Order::create_order( 1, $product );
+		$order->save();
+
+		// Generate structured data.
+		$this->structured_data->generate_order_data( $order );
+		$data = $this->structured_data->get_data();
+
+		// Get the first structured data entry (should be order).
+		$this->assertNotEmpty( $data );
+		$order_data = $data[0];
+
+		// Check that priceSpecification exists and contains valueAddedTaxIncluded as a boolean.
+		$this->assertArrayHasKey( 'priceSpecification', $order_data );
+		$this->assertArrayHasKey( 'valueAddedTaxIncluded', $order_data['priceSpecification'] );
+		$this->assertIsBool( $order_data['priceSpecification']['valueAddedTaxIncluded'] );
+		$this->assertTrue( $order_data['priceSpecification']['valueAddedTaxIncluded'] );
+
+		// Clean up.
+		$order->delete( true );
+		$product->delete( true );
+	}
+
+	/**
+	 * @testdox valueAddedTaxIncluded is not present in order structured data when taxes are disabled.
+	 *
+	 * @return void
+	 */
+	public function test_order_structured_data_excludes_vat_when_taxes_disabled(): void {
+		// Disable taxes.
+		update_option( 'woocommerce_calc_taxes', 'no' );
+
+		// Create a simple product and order.
+		$product = WC_Helper_Product::create_simple_product();
+		$product->set_regular_price( 10 );
+		$product->save();
+
+		$order = WC_Helper_Order::create_order( 1, $product );
+		$order->save();
+
+		// Generate structured data.
+		$this->structured_data->generate_order_data( $order );
+		$data = $this->structured_data->get_data();
+
+		// Get the first structured data entry (should be order).
+		$this->assertNotEmpty( $data );
+		$order_data = $data[0];
+
+		// Check that priceSpecification exists.
+		$this->assertArrayHasKey( 'priceSpecification', $order_data );
+
+		// valueAddedTaxIncluded should not be present when taxes are disabled.
+		$this->assertArrayNotHasKey( 'valueAddedTaxIncluded', $order_data['priceSpecification'] );
+
+		// Clean up.
+		$order->delete( true );
+		$product->delete( true );
+	}
+
 	/**
 	 * When a variable product page is requested for a single, fully-specified variation, the offer
 	 * should describe that variation with a single Offer and exact price (no AggregateOffer range),