8 – How to change a type of store?

I have several types of stores on my site and I want to change the button Add to Basket of all products associated with the type of store online (online is the name of the machine of my store type).

How to do that?

The custom module below works and changes the Add to Basket button for products in all types of stores.

How to limit it to the type of store online ?

This must be applied to the products of the current store.

use Drupal  commerce_product  Entity  ProductType;
use Drupal  commerce_product  Entity  ProductVariationType;
use Drupal  Core  Entity  Display  EntityViewDisplayInterface;
use Drupal  Core  Entity  EntityInterface;
use Drupal  Core  Url;

/ **
* Online Store.
* /
function MYMODULE_form_commerce_order_item_add_to_cart_form_alter (& $ form,  Drupal  Core  Form  FormStateInterface $ form_state, $ form_id) {
$ current_store =  Drupal :: service (& # 39; trade_store.current_store & # 39;);
if (isset ($ form["#attributes"]["class"]) && in_array ("commerce-order-item-add-to-cart-form", $ form["#attributes"]["class"])) {
$ selectedVariationId = $ form_state-> get (& # 39; selected_variation & # 39;);
$ selectedVariation =  Drupal  commerce_product  Entity  ProductVariation :: load ($ selectedVariationId);
$ form['actions']['submit']['#value']    = t (& # 39; Subscribe & # 39;);
}
}