Skip to content
This repository has been archived by the owner on Feb 23, 2024. It is now read-only.

Commit

Permalink
Add data-price button attribute containing product price (#11117)
Browse files Browse the repository at this point in the history
* Add data-price button attribute containing product price

* Fix phpcs error.

---------

Co-authored-by: Dima <9010963+message-dimke@users.noreply.github.com>
  • Loading branch information
2 people authored and roykho committed Oct 9, 2023
1 parent f623ae3 commit f67b5e4
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions src/BlockTypes/AbstractProductGrid.php
Original file line number Diff line number Diff line change
Expand Up @@ -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',
);
Expand Down

0 comments on commit f67b5e4

Please sign in to comment.