This time I'm showing you, how you can automatically add another order item after a product has been added to the cart in Drupal Commerce 2.x. The most important info here is, how you can pass the pitfall of possible transient data problems here.
Commerce ships with a default success message after adding a product to the shopping cart. This is done via an event subscriber, in order to be easy customizable. However, removing, replacing or extending existing services in Drupal 8 is a thing, not every developer is used to do. I'll show you, how easy this is.
There are a couple of modules out there to ajaxify the add to cart form of Drupal Commerce, but I'll introduce to one that on top offers a real decoupled solution. Additionally I'll show how you can achieve a simpler version of that with only a few lines of custom JS code.
Today I'm introducing you to a new contrib module, I've created for allowing "add to cart" (or wishlist) buttons as links instead of forms. This helps to circumvent some unfortunate Drupal core limitations, when you want to build overview pages or blocks.
Being one of the first early adopters of Drupal Commerce 2.x by starting our first project in early 2016 (on alpha2 version) and soon after a second one, I originally planned to write a blog post soon after beta1 gets published. Unfortunately I was too busy at that time....
Today I was tracking down a strange issue with a form submission and validation, which finally turned out to be the consequence of an unobvious wrong function call inside a class constructor.
Today I'll explain, how we've build our own Inline Conditions in order to support Commerce Discount rules based on taxonomy terms of product display nodes.
When defining product display node types and product entity types in Drupal Commerce, it can be a hard decision where to put taxonomy term reference fields like the product category to. In this post, I try to sum up arguments from different perspectives and give some helpful advice in finding the right decision for you shop project.
There's a great tutorial on drupal.org, written by Jim Bova, explaining how to create a "related products" block in Drupal Commerce. While I was building a similar Views block based on this tutorial, I've found some improvements that are imho both cleaner and more performant, completely relinguishing the use of Views PHP module.