Skip to main content
Share Your Experience: Take the 2024 Developer Survey
3 votes
Accepted

How can I handle race conditions in a headless setup?

There are many ways to handle stock preventing overselling ... from a pattern standpoint, not necessarily from a contrib standpoint. However, our least favorite version is using a field on the product ...
Ryan Szrama's user avatar
  • 7,030
3 votes

How to translate the administrative area in an address field?

Drupal Commerce uses the Address module for handling addresses. In Address fields, Japanese prefectures correspond to Administrative area (e.g. State or Province). I just installed the Address module ...
Patrick Kenny's user avatar
2 votes
Accepted

Solr autocomplete does not work for Product Variations

Search API autocomplete requires a canonical links for entities to build suggestions list. Even if there is a result from index server, if it can't build a link, this result will be ignored. In your ...
Олег Чемерис's user avatar
2 votes

How do I install commerceguys/addressing and commerceguys/int

As per the project page, "Commerce 2.x should only be installed via Composer", and via the Drupal commerce documentation site: cd /path/to/drupal8 composer require "drupal/commerce"...
Wongjn's user avatar
  • 146
1 vote

Title field does not show for product

Ok, it's a problem with the theme. I was using Drupal8 Zymphonies and it must be set for titles not to show. Changed the theme and that problem was solved.
Tiffani Chin's user avatar
1 vote
Accepted

How to get entity object in buildform formbase?

You need to declare type type of object that {commerce_product} is in your routing definition: project.product_elasticsearch: path: '/product/{commerce_product}/elasticsearch' defaults: _form: ...
Jaypan's user avatar
  • 17.6k
1 vote
Accepted

What do I enter in the API Username and API password for the Commerce CardPointe module so that it works with Clover Connect?

For those who find this later, it turns out you need to get the API username and password from technical support when you setup your CardPointe account. This will be different from the relationship ...
Ryan Szrama's user avatar
  • 7,030
1 vote
Accepted

Removing data from an entity type

The issue is that the Authorize.Net module defines a PaymentType plugin that serves as the bundle for Payment entities created by the Accept.js payment gateway. I don't recall why we decided to use a ...
Ryan Szrama's user avatar
  • 7,030
1 vote
Accepted

Do content types play any role for ecommerce product webpages?

As of Drupal 8, Commerce Core defines a new type of content entity named Product to serve the function of product display page as opposed to Node, which we used in Drupal 7 and earlier. Modules that ...
Ryan Szrama's user avatar
  • 7,030
1 vote

Commerce module can't be enabled

Manually If you install the module manually then module dependencies are not getting installed automatically. Some required dependent modules might be missing. If you add these dependent missing ...
hetal chavda's user avatar
1 vote
Accepted

How to add extra validate hook to the order information form?

$form['actions']['next']['#submit'][] = '_altpay_form_validate'; You're actually adding it to the submit function. Which makes sense the errors that you're seeing since it's too late to do any form ...
No Sssweat's user avatar
  • 31.3k
1 vote

Show message after redirection

A controller has to return the result, this includes the redirect response. But before you have to set the message: $redirect = new RedirectResponse('/checkout/' . $order_id . '/review'); $this->...
4uk4's user avatar
  • 100k
1 vote
Accepted

Discount for emails with specific domain

This is not possible in the current state of the plugin (OrderEmail) that provides this condition. It uses an email element, meaning the Drupal Forms API will validate input to ensure it's an email ...
Ryan Szrama's user avatar
  • 7,030
1 vote

How can I email admin when stock is 0?

By looking at the code proposed by the module commerce_stock I believe you'll have to write a new EventSubscriber that subscribe to the event onOrderComplete. So you create the file: modules/custom/...
Denis K's user avatar
  • 404
1 vote

Is Drupal Commerce compatible with Drupal 10?

Commerce 8.x-2.36 is marked as Drupal 10 compatible: https://www.drupal.org/project/commerce
Jaypan's user avatar
  • 17.6k
1 vote

Is Drupal Commerce compatible with Drupal 10?

Seems to be more of an issue of being on a compatible host server than D10. You'll want an up to date composer too as well as being on PHP 8.1. You should be using composer with D9/10, unless you want ...
EagleUK's user avatar
  • 151
1 vote
Accepted

Are extra fields added with hook_entity_extra_field_info(). not available on product variation pages?

In general, this hook only adds metadata to the entity view mode. You have to add the output in a different hook if the view mode has this field configured: /** * Implements hook_ENTITY_TYPE_view(). ...
4uk4's user avatar
  • 100k
1 vote

How do I get information about the payment method from the order object programmatically?

It looks like it changed at some point after 2018. I could only get the label in this way (for my offsite payment method): use Drupal\commerce_payment\Entity\PaymentGateway; /** @var PaymentGateway $...
Andreas's user avatar
  • 412

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