Explorar o código

changed 'add to cart' button text

bach %!s(int64=3) %!d(string=hai) anos
pai
achega
b28b8cedde
Modificáronse 1 ficheiros con 16 adicións e 0 borrados
  1. 16 0
      web/themes/custom/materiotheme/materiotheme.theme

+ 16 - 0
web/themes/custom/materiotheme/materiotheme.theme

@@ -199,6 +199,22 @@ function materiotheme_form_alter(&$form, FormStateInterface $form_state, $form_i
       "@click.prevent.stop" => "checkaddtocart(\$event, $variation_id)"
     );
   }
+
+  // change "add to cart" button text
+  switch ($form_id) {
+    case 'commerce_order_item_variation_cart_form_form_commerce_product_variation_3':
+      $form['actions']['submit']['#value'] = t('Yeees!');
+      break;
+    case 'commerce_order_item_variation_cart_form_form_commerce_product_variation_4':
+      $form['actions']['submit']['#value'] = t('Yay!');
+      break;
+    case 'commerce_order_item_variation_cart_form_form_commerce_product_variation_5':
+      $form['actions']['submit']['#value'] = t('Great!');
+      break;
+    case 'commerce_order_item_variation_cart_form_form_commerce_product_variation_6':
+      $form['actions']['submit']['#value'] = t('OKAY!');
+      break;
+  }
 }
 
 /**