Automattic / woocommerce-subscriptions-core

Subscriptions core package for WooCommerce
Other
80 stars 29 forks source link

Use `wc_wp_theme_get_element_class_name()` instead of hardcoding the `wp-element-button` class name #582

Closed mattallan closed 3 months ago

mattallan commented 3 months ago

Fixes #569

Description

In https://github.com/Automattic/woocommerce-subscriptions-core/pull/574 we merged a small change to fix the styling of our "Sign up now" on subscription product pages for stores using a block theme (i.e. 2024 default theme).

This PR tweaks the code slightly to use wc_wp_theme_get_element_class_name() instead of hardcoding the wp-element-button class name.

The wc_wp_theme_get_element_class_name() function was added to WooCommerce Core in v7.0.1 which is below our minimum supported version so no need to check this function exists.

How to test this PR

[!NOTE] Since we already fixed the button styling issue in a previous PR, there won't be any noticeable issues to confirm are fixed in this PR. Instead we'll just be checking our sign up buttons contain the correct class names.

  1. Activate the 2024 default theme
  2. Visit a simple subscription and confirm the page is styled correctly.
  3. Inspect the Sign up button and confirm it contains the 'wp-element-button' class name: image

Product impact