From df87fabfc72d5831907a27a2f302d9fb9ce6d815 Mon Sep 17 00:00:00 2001 From: Dmytro Date: Mon, 9 Oct 2023 17:33:48 +0300 Subject: [PATCH] Add data-price button attribute containing product price (#11117) * Add data-price button attribute containing product price * Fix phpcs error. --------- Co-authored-by: Dima <9010963+message-dimke@users.noreply.github.com> --- src/BlockTypes/AbstractProductGrid.php | 1 + 1 file changed, 1 insertion(+) diff --git a/src/BlockTypes/AbstractProductGrid.php b/src/BlockTypes/AbstractProductGrid.php index 6196cb50880..a7460767493 100644 --- a/src/BlockTypes/AbstractProductGrid.php +++ b/src/BlockTypes/AbstractProductGrid.php @@ -649,6 +649,7 @@ protected function get_add_to_cart( $product ) { 'data-quantity' => '1', 'data-product_id' => $product->get_id(), 'data-product_sku' => $product->get_sku(), + 'data-price' => wc_get_price_to_display( $product ), 'rel' => 'nofollow', 'class' => 'wp-block-button__link ' . ( function_exists( 'wc_wp_theme_get_element_class_name' ) ? wc_wp_theme_get_element_class_name( 'button' ) : '' ) . ' add_to_cart_button', );