5

The package that triggers the error is drupalcommerce/project-base. If you check the composer information for that package you see: "require": { "php": ">=7.0.8", "ext-curl": "*", "composer/installers": "^1.2", "cweagans/composer-patches": "^1.6.5", [...] As you see, it requires PHP 7.0.8 or higher. You have ...


4

you could do something like this: use Drupal\Core\Form\FormStateInterface; use Symfony\Component\HttpFoundation\RedirectResponse; function MYMODULE_form_alter(&$form, FormStateInterface $form_state, $form_id) { if (strpos($form_id, 'commerce_order_item_add_to_cart_form_commerce_product') !== false) { $form['actions']['submit']['#submit'][] = '...


4

You need to unset the #value on your image_buttons: $item['#type']='image_button'; $item['#src']='sites/all/themes/mytheme/images/trash.svg'; $item['#alt']='Remove'; unset($item['#value']); // this line here The line item that is deleted is determined by the #triggering_element in your $form_data. This element is determined by a function ...


4

You can do that by Implements hook_form_BASE_FORM_ID_alter but that would allow passing the step if the user enters any random string inside the coupon field. To avoid this confusion you need to use the form alter to make coupon field required and also add custom validation to check if the coupon is valid. if the coupon is not valid, then the user will ...


4

There are two methods that are the "Drupal" way. One is to write a PHP script that changes the products as needed. You would write a loop, load the products, update, and then save them. You then can the execute this script with drush as drush scr whatever.foo. This will bootstrap Drupal, and then execute the script in the context of a running Drupal ...


3

If the data about a product are not available when processing a "line item", you can make them available. To do so, use a technique similar to what is explained in my answer to "How to access commerce_product field of line-items using Rules to flag the Commerce Product?", which includes a Rules Component that looks like so: { "...


2

Instead of unsetting the #value property (which works, but I find it personally counter-intuitive), you could try setting it by using the form_type_image_button_value() function. As an example: function my_custom_module_form_views_form_commerce_cart_form_default_alter(&$form, &$form_state, $form_id) { if (!empty($form['edit_delete'])) { ...


2

It looks like you have Commerce AutoSKU installed. The authors of the module modify one of Drupal's validation constraints which checks if fields are empty or not. This causes the addressbook form element to break, which what you're seeing, on top of other problems. The issue is reported here, https://www.drupal.org/project/commerce_autosku/issues/3086828 ...


2

As @No Sssweat points out in a comment on your original post, there is no Commerce 1 for Drupal 8, so if you're upgrading your site to Drupal 8, Commerce 2 is your only option. But even if that weren't the case, Commerce 2 is stable and it's where all the current improvements in Commerce are happening. While Commerce 1 may have a larger contrib ecosystem at ...


1

I know this is an old thread, but I encountered the same problem. So in case you have the same issue: This isn't really a commerce question, rather a general one. There is a hook, where you can simple add new fields to an existing entity: HOOK_entity_base_field_info So in this case: /** * Implements hook_entity_base_field_info(). */ function ...


1

In Drupal 7, you can use the form_state_values_clean() function that removes: form_id form_token form_build_id op Usage example: <?php /** * Let's say this is your form. */ function your_form($form, &$form_state) { // Form items go here. // Let's add the form actions element... $form['actions'] = array( '#type' => 'actions', ); ...


1

You need to configure the Stock Services found at /admin/commerce/config/stock/settings and choose Local Stock for your product variation. Related topic can be found here. EDIT: reading your question again and it seems that you added the field to the product itself, instead of adding it to the product variation. Stock field needs to be attached to the ...


1

The bug is in your code. max_age should actually be max-age. See the documentation page for more information: https://www.drupal.org/docs/8/api/cache-api/cache-max-age You could also set the max age in Jdrupal's answer.


1

This was fixed by passing ['order_notes'] into $values. /** * {@inheritdoc} */ public function submitPaneForm(array &$pane_form, FormStateInterface $form_state, array &$complete_form) { $values = $form_state->getValue($pane_form['#parents']); $this->order->set('field_order_notes', $values['order_notes']); }


1

In some twig templates of the commerce modules, I can see the use of an alternate syntax: This is only in one module - Commerce Cart Flyout. These are Underscore.js templates. These are used to customize the JavaScript progressively decoupled cart flyout. These are not actually Twig templates. It was a design decision I regret to try and enable end-users ...


1

You cannot directly manipulate the order total like this, as it gets recalculated based on its line items' prices each cart refresh. (That happens on every pageload in checkout and however you've configured it for other routes.) You should look into the Commerce Multicurrency module instead or else configure your pricing rules / otherwise hook into product ...


1

Found answer to my own question. I discovered the conditional rules module and came up with this rule component for each product type: { "rules_empty_cart__consumer_g" : { "LABEL" : "Empty cart - consumer g", "PLUGIN" : "reaction rule", "OWNER" : "rules", "REQUIRES" : [ "rules", "rules_conditional", "commerce_cart", "commerce_order" ], "...


1

The standard approach here is to use the payment information to create an authorization for as much as you will need assuming the order is to be placed. If it's for $100 of custom merchandise, you authorize a $100 charge on the customer's credit card and then capture it after manual review. This is very typical and in many places a requirement - the idea ...


1

D7, install Conditional rules module, this module let's you add aditional conditions at action section in rules UI. You say your event is 'checkout proccess', so, the first thing you need is to load your 'pizza' node object in to rules, I am assuming that you have a field in your product-fields referencing to your 'pizza-content-type'. To do this, in ...


1

Compatible with PHP 7.2? Yes, currently the only issue I see in the issue queue is: PHP 7.2 Warning: A non-numeric value encountered in commerce_currency_amount_to_decimal() You'll have to apply this patch yourself since it has not been committed.


1

to get ALL orders of a user - get user ID ($user_id) then $orders = \Drupal::entityTypeManager() ->getStorage('commerce_order') ->loadByProperties(['uid' => $user_id]);


1

As far as I understand you could restrict block from being shown in front page, from block visibility settings. Alternatively, you could also make a custom template for the front page.


1

Any module you distribute must be licensed under the GPL 2.0 or later. You are free to put it up for sale so long as anyone who buys it enjoys the same rights of redistribution - that's just the nature of Drupal's license overall. Anyone who buys your module will be free to put it up on drupal.org and redistribute it at will.


1

With the offer types defined in Commerce Discount / Commerce Discount Extra, there isn't much you can do. The closest ones to what you've described are the per-quantity % off discounts, but as you've discovered, you have to specify either a target product or product category. If you're using a taxonomy configuration that allows the per-quantity category ...


1

This feature does not exist in core yet but it is in progress right now. Look for it in Commerce 2.13.


Only top voted, non community-wiki answers of a minimum length are eligible