Merge pull request #29603 from masteradhoc/masteradhoc-accessibility-strikethrough-price
Improve WooCommerce Accessibility - Strikethrough Price
This commit is contained in:
commit
ec77c3bcc9
|
@ -179,7 +179,7 @@ class WC_Order extends WC_Abstract_Order {
|
|||
}
|
||||
|
||||
if ( $total_refunded && $display_refunded ) {
|
||||
$formatted_total = '<del>' . wp_strip_all_tags( $formatted_total ) . '</del> <ins>' . wc_price( $order_total - $total_refunded, array( 'currency' => $this->get_currency() ) ) . $tax_string . '</ins>';
|
||||
$formatted_total = '<del aria-hidden="true">' . wp_strip_all_tags( $formatted_total ) . '</del> <ins>' . wc_price( $order_total - $total_refunded, array( 'currency' => $this->get_currency() ) ) . $tax_string . '</ins>';
|
||||
} else {
|
||||
$formatted_total .= $tax_string;
|
||||
}
|
||||
|
|
|
@ -1265,7 +1265,7 @@ function wc_format_stock_quantity_for_display( $stock_quantity, $product ) {
|
|||
* @return string
|
||||
*/
|
||||
function wc_format_sale_price( $regular_price, $sale_price ) {
|
||||
$price = '<del>' . ( is_numeric( $regular_price ) ? wc_price( $regular_price ) : $regular_price ) . '</del> <ins>' . ( is_numeric( $sale_price ) ? wc_price( $sale_price ) : $sale_price ) . '</ins>';
|
||||
$price = '<del aria-hidden="true">' . ( is_numeric( $regular_price ) ? wc_price( $regular_price ) : $regular_price ) . '</del> <ins>' . ( is_numeric( $sale_price ) ? wc_price( $sale_price ) : $sale_price ) . '</ins>';
|
||||
return apply_filters( 'woocommerce_format_sale_price', $price, $regular_price, $sale_price );
|
||||
}
|
||||
|
||||
|
|
|
@ -926,7 +926,7 @@ class WC_Tests_Formatting_Functions extends WC_Unit_Test_Case {
|
|||
* @since 3.3.0
|
||||
*/
|
||||
public function test_wc_format_sale_price() {
|
||||
$this->assertEquals( '<del><span class="woocommerce-Price-amount amount"><bdi><span class="woocommerce-Price-currencySymbol">£</span>10.00</bdi></span></del> <ins><span class="woocommerce-Price-amount amount"><bdi><span class="woocommerce-Price-currencySymbol">£</span>5.00</bdi></span></ins>', wc_format_sale_price( '10', '5' ) );
|
||||
$this->assertEquals( '<del aria-hidden="true"><span class="woocommerce-Price-amount amount"><bdi><span class="woocommerce-Price-currencySymbol">£</span>10.00</bdi></span></del> <ins><span class="woocommerce-Price-amount amount"><bdi><span class="woocommerce-Price-currencySymbol">£</span>5.00</bdi></span></ins>', wc_format_sale_price( '10', '5' ) );
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -259,11 +259,11 @@ class WC_Tests_Product_Data extends WC_Unit_Test_Case {
|
|||
|
||||
$product = wc_get_product( $product1_id );
|
||||
$this->assertEquals( $product1_id, $product->get_id() );
|
||||
$this->assertEquals( '<del><span class="woocommerce-Price-amount amount"><bdi><span class="woocommerce-Price-currencySymbol">£</span>10.00</bdi></span></del> <ins><span class="woocommerce-Price-amount amount"><bdi><span class="woocommerce-Price-currencySymbol">£</span>7.00</bdi></span></ins>', $product->get_price_html() );
|
||||
$this->assertEquals( '<del aria-hidden="true"><span class="woocommerce-Price-amount amount"><bdi><span class="woocommerce-Price-currencySymbol">£</span>10.00</bdi></span></del> <ins><span class="woocommerce-Price-amount amount"><bdi><span class="woocommerce-Price-currencySymbol">£</span>7.00</bdi></span></ins>', $product->get_price_html() );
|
||||
|
||||
$product = wc_get_product( $product2_id );
|
||||
$this->assertEquals( $product2_id, $product->get_id() );
|
||||
$this->assertEquals( '<del><span class="woocommerce-Price-amount amount"><bdi><span class="woocommerce-Price-currencySymbol">£</span>20.00</bdi></span></del> <ins><span class="woocommerce-Price-amount amount"><bdi><span class="woocommerce-Price-currencySymbol">£</span>16.00</bdi></span></ins>', $product->get_price_html() );
|
||||
$this->assertEquals( '<del aria-hidden="true"><span class="woocommerce-Price-amount amount"><bdi><span class="woocommerce-Price-currencySymbol">£</span>20.00</bdi></span></del> <ins><span class="woocommerce-Price-amount amount"><bdi><span class="woocommerce-Price-currencySymbol">£</span>16.00</bdi></span></ins>', $product->get_price_html() );
|
||||
|
||||
$product = wc_get_product( $product3_id );
|
||||
$this->assertEquals( $product3_id, $product->get_id() );
|
||||
|
|
Loading…
Reference in New Issue