New answers tagged

0

Your version of Commerce Discount is too outdated to support discount compatibility. However, it's so old, that the upgrade process may be complicated. Drupal Commerce itself is also currently at version 1.15, so that will need to be updated, too. I'd recommend creating a copy of your website and bringing those modules up to date, maybe even one version at ...


0

Figured it out! Took a few steps: I created a View of type: Order Item. Added my custom fields to that view (Job Title, etc). Added a Contextual Filter "Order item: ID". Provide Default Value: Content ID from URL. I created a Viewfield on each of my Order Item Types, using the View I created in the previous step. I went to /admin/commerce/config/order-item-...


1

The user ID is saved on the store when it's created. Therefore you can load it with code similar to the following one. $store = \Drupal::entityTypeManager()->getStorage('commerce_store')->loadByProperties(['uid' => \Drupal::currentUser()->id()]); That will load the store based on the currently logged-in user.


0

Of course I came across the solution minutes after posting this question: https://www.drupal.org/project/contrib_tracker/issues/2735517#comment-11716303 In short, create the fields in the Order Item Type, then make those fields visible on that OIT's Add To Cart Form Display.


0

Drupal Commerce doesn't currently have a STABLE bundle module ported to 8, but if you like living on the edge, commerce_product_bundles which is under development MIGHT be able to get the job done. You can assign multiple bundle items (a product wrapped in a bundle item) to a bundle group (a group of bundle items sold together), and can specify the minimum ...


1

As far as I know, there are no supported modules to acheive what you want. So if you want a sustainable and future proof solution, you should probably code it yourself. I would go for solution, where I create a custom entity type, Product Validation. Here are some fields, that I think it should contain: Product ID (The product it's active on). Applies ...


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 ...


0

The Path field has been deprecated, use Link to content instead. More info in this answer: How to get Node Url in RSS view? When you have to construct a different output out of field values it's good to use the Custom text Field. Exclude from display your Title, Image, and Link to content fields, reorder the fields so the Custom text field comes last. ...


0

Giorgosk's answer didn't fix the problem but it did lead me to notice that the name of my .yml and .module files didn't match the short name I had given the module, and that was the reason for the bizarre error messages. Thanks!


0

Conditionals are still the answer, but turns out there's an easier way that doesn't involve getting the current path: function MYMODULE_form_commerce_checkout_flow_multistep_default_alter(&$form, \Drupal\Core\Form\FormStateInterface $form_state, $form_id) { if ($form['#step_id'] == 'order_information') { Do stuff to the order information page form....


0

Although above answer is marked I will give more verbose info. You need to make a resolver service so it can "hook" into commerce_checkout.checkout_flow_resolver service collector commerce_checkout.chain_checkout_flow_resolver: class: Drupal\commerce_checkout\Resolver\ChainCheckoutFlowResolver tags: - { name: service_collector, call: ...


0

You should be able to get the product from the order which is available in the template. I think that this will give you the products: {% for order_item in order_entity.getItems %} {{ order_item }}// The product {{ order_item.FIELD_NAME.value }}// The field value {% endfor %} Otherwise you must add the product in a preprocess function.


0

Via kint and a bunch of trial and error I identified the right way to do this: {% if 'Ball' in product.field_myproduct_type.0['#plain_text'] %} Order Ball {% endif %} {% if 'Block' in product.field_myproduct_type.0['#plain_text'] %} Order Block {% endif %} Thank you 100pic for your assistance.


0

public function getCacheMaxAge() { return 0; } Add the above code after block's build function.


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.


Top 50 recent answers are included