Questions tagged [commerce]
One of the modules that implements an eCommerce framework and ecosystem is the Drupal Commerce module.
3,906
questions
1
vote
0
answers
17
views
How do I decide where to put these fields in a Commerce License architecture?
I'm creating a License Type using Commerce License. It will allow a user that owns a group to purchase seats on that group for other users. Therefore, at purchase time, I need to associate a group ...
1
vote
1
answer
133
views
Drupal Commerce Product Variation SQL Injection Vulnerability
A PCI scan on my site is saying that there is a SQL Injection vulnerability. But where it seems to be indicating it is on pretty basic Commerce functionality. When visiting a product variation page ...
0
votes
1
answer
244
views
Change product price title in form
How can I access the label of the product price field to change it for example to "amount" instead of "price"?
The html for the field is:
<div class="js-form-item form-item ...
0
votes
0
answers
86
views
Set minimum commerce product price
I want to set a minimum price that can be entered in the product add/edit form of Commerce. If users enter a lower price, an error should be displayed, when they click on the save button.
I am using ...
2
votes
1
answer
379
views
Commerce order delete and order item delete events
Quick question I hope someone can easily answer.
There are two order events for order delete listed here: https://github.com/drupalcommerce/commerce/blob/8.x-2.x/modules/order/src/Event/OrderEvents....
0
votes
1
answer
31
views
Event called when an order line is removed
In Drupal Commerce what event do i need to subscribe to when an order line is removed?
This questions talks about an order being removed/deleted: Which events are invoked when an order is removed or ...
2
votes
0
answers
39
views
Error while trying to create a local task for user order history
I am attempting to add a local task here (/admin/commerce/orders/{order#}). This local task should contain a view that takes the userid from the current order and displays that users order history.
I ...
0
votes
0
answers
34
views
How do I save a specific "state" of the product in the order item?
I'd be necessary for my site to save "a specific state" of the product(s) and relative variation(s) purchased in the order.
I mean, with the "standard" Commerce configuration, in ...
0
votes
1
answer
41
views
How can I access or expose the Commerce data in $order->data[] to the Rules module?
Following this old checkout_pane_example.module tutorial, I created a custom Drupal 7 Commerce checkout pane. It's simply a text field to collect special order instructions from the customer.
...
0
votes
1
answer
20
views
Where did my commerce token go after an update to 7.87
My Drupal 7 commerce setup sends out a couple of emails after an order is placed. It uses this token:
[commerce-order:commerce-customer-shipping:commerce_customer_address]
After updating to Drupal 7....
0
votes
1
answer
136
views
Setting $order_item->setUnitPrice($price, TRUE);) stops cart items being merged, how to prevent this?
Drupal Commerce 2, with Drupal 9.
In the CART_ENTITY_ADD event, if i set $order_item->setUnitPrice($price, TRUE); identical items added to the cart get added as new order items, but I want them to ...
0
votes
1
answer
210
views
How to get Commerce price without any adjustments
I'm trying to show "Buy for XX USD more and get free shipping", I know how to get $cart->get('total_price')->getValue()[0]['number'] but it is including any adjustments including ...
1
vote
1
answer
41
views
Is there a way to stop Commerce from hiding the customer address info when adding a user?
We are using Phone 7.x-1.0-beta1 only because it is required to perform API calls to our ERP. After upgrading to Commerce 7.x-1.16 the address info under add user is collapsed by default. Since the ...
0
votes
1
answer
41
views
Product parameters on add to cart form which not changing product variation
I have a phisycal product with many many combinations.
E.g.: a mug which is available in 20 different colors and with 30 different prints. This means 600 combinations.
We don't have stock. We don't ...
0
votes
2
answers
131
views
Customer profiles cannot hold more than 1 values, even when allowing multiple profiles per user
I have custom API that creates new Customer profiles with different addresses / emails:
$profileStorage->create([
'type' => 'customer',
'uid' => $this->currentUser->id(),...
2
votes
1
answer
277
views
Safely save data to the order in onNotify()
I'm new to Drupal and have to make an off-site payment gateway (with Drupal Commerce 2). It all works, but sometimes it doesn't.
The remote payment provider's server sends notification requests to the ...
-1
votes
1
answer
182
views
Get the value of Entity reference revisions field in order email twig file
I want to get the entity reference field value in order email.
Name of the entity reference is field_price_value and called paragraph field is field_price now I want to get the field price value
I ...
-1
votes
1
answer
114
views
Set the quantity per product equal to value in input
I'm using the Commerce Ajax Add to Cart module to add a product to my cart using AJAX. I guess I'll have to do that by creating a patch.
It's working fine, but I'd like to change how a product is ...
1
vote
1
answer
130
views
How to exclude taxes from total prices but still show the tax during checkout
So I create a tax type Custom and set the rate 18%. The checkbox Display taxes of this type inclusive in product prices. comes in checked by default. If I leave it like that, cart shows product price ...
0
votes
1
answer
56
views
Which attributes are used for product variations on the PDP (product display page)?
Let's assume we have one product with 2 product variations. Both the variations have 10 product attributes each; they are all filled with their option values, for example color = Blue, size = 10L, or ...
0
votes
1
answer
83
views
How do I add a product variance title to the order information page?
I am looking to have the Product Title appear in the Order Information page. However, the data is pulling the price versus the product title. I attempted to change the views. No luck. I am not a ...
1
vote
0
answers
61
views
How can I programmatically configure commerce checkout pane settings?
In Commerce, we have custom pane and checkout configuration that applies to all orders. Per this d.o issue in commerce_features, this is supposedly doable. However, Commerce's default configuration ...
0
votes
0
answers
28
views
Tax round calculation on order
How can we round up the tax to 2 decimals, but the last decimal should be either 0 or 5.
I have this rule for the round up:
if ($decimal % 10 <= 2) {
// Here, the last decimal should be 0.
}
else ...
1
vote
1
answer
88
views
How can I disable products so they are unpurchase-able and also display in a view?
I have a view of published products. I want to also create a view of unpublished products, so users can see previous products that were available, but there shouldn't be an Add to cart button on these ...
0
votes
1
answer
88
views
Creating a store in the Commerce module fails
Using Drupal 9, latest release of Commerce 8.x-2.28. I followed the Lugwig install instructions for the Commerce module. Everything seemed to install OK.
When I fill out the Create Store form, I get ...
0
votes
0
answers
212
views
How can I show tax per line item at checkout?
In D7, there was a module named 'Commerce price by components' which allowed us to display a price inclusive or exclusive of tax.
I would like to show a detailed tax breakdown at checkout as most of ...
0
votes
1
answer
509
views
Programmatically getting variation type fields in order
I am trying to get variation type field values from the order entity but I can't find any documentation on this. I am using an event subscriber to run the following code when an order is paid. The ...
0
votes
0
answers
157
views
Drupal 9 Commerce change the Pay button text
I have created Drupal 9 website. On the website we accept donations using Commerce with Commerce Stripe as the payment processor. By default, the payment button says "Pay and complete purchase&...
1
vote
0
answers
73
views
Adding Current Product page Variant ID/SKU to webform submission Drupal 8
I have product type event, this event have registration fees if price value not zero.
Product page built with views and I embed related webform inside it.
am using module called commerce webform order:...
0
votes
1
answer
32
views
Hide pane based on cart state
Can anyone point me to a right direction.
I have created a custom Checkout flow and it has payment pane in it.
I'm trying to skip payment pane if the Cart state changed (default cart state is draft)
I ...
1
vote
1
answer
360
views
How do I install a working demo?
I have been struggling with this for quite some time. I am trying to install a demo of the Commerce module as provided by Centarro, but every time the install finishes, I only get an empty site with ...
1
vote
1
answer
73
views
How do I render a commerce promotion coupon code on the order details?
I want to show a coupon code used on an order details page, but cannot seem to render it on a templates. Here are some things I have tried so far...
{% for coupon in order_entity.coupons %}
{{ ...
0
votes
0
answers
33
views
How do I know what properties and methods are available to an entity_metadata_wrapper object?
It may be easiest to start with an example.
The entity_metadata_wrapper() function seems to do a lot of complex magic behind the scenes in order to return an object with all data related to the entity ...
1
vote
1
answer
142
views
Redirect directly to the payment provider page
I'm building a store with Drupal Commerce and creating my own off-site payment gateway.
On the review page, after selecting payment method, the user can click the button to pay and finish the order.
...
-3
votes
1
answer
128
views
Change workflow state with particular payment method
Right now i have a payment method called "Transferência Bancária" and I need it to change to the workflow state "Awaiting Transferencia" automatically when that payment method is ...
0
votes
1
answer
57
views
Syncing of order and shipping states
In Drupal 9, I have defined the following order workflow for Drupal Commerce:
miss_pomela_fulfillment_processing:
id: miss_pomela_fulfillment_processing
group: commerce_order
label: 'Miss Pomela ...
2
votes
1
answer
78
views
Migrate order billing profile
I'm trying to migrate order data from an existing site using CSV files and I can't get the billing profile to relate.
In trying to troubleshoot this, I have it set just to insert a default value of a ...
0
votes
1
answer
191
views
Access product field from variation field
There are a bunch of product images that are named same as SKU, so I'm just using field--commerce-product-variation--sku.html.twig to show them. All is fine.
I'd like to use the parent product image ...
0
votes
0
answers
101
views
With Rules, how do I use variables with Calculate and Set a value actions?
Let's say I have an Entity with a custom integer field added. Let's call the field Global Total (field_global_total)
On some event, I want to
get the existing value of that field and store it in a ...
1
vote
1
answer
705
views
How do I programmatically create an order without deleting a profile?
I followed Orders to write the following code.
$order = \Drupal\commerce_order\Entity\Order::create([
'type' => 'custom_order_type',
'state' => 'draft',
'mail' => '[email protected]',
'...
0
votes
1
answer
309
views
How to add conditions to display product variations in Drupal commerce?
In the products page, I want to limit product variations based on user roles.
For example, I only want admin to be able to see some of the product variation.
I tried to achieve this by adding an extra ...
1
vote
1
answer
116
views
Product Attributes that do not require product variations
I am trying to figure out if it is possible to have product attributes that do not require individual SKUs and do not have to be entered as product variations. My use case is this: We are selling ...
1
vote
1
answer
356
views
How to get product variation media file url using jsonapi?
I'm using the following jsonapi GET request to retrieve product variations for a product:
/jsonapi/commerce_product/default/0ea927c7-b62d-45c9-8bec-dc3d16215276/variations?include=field_images
...
1
vote
1
answer
183
views
Why custom condition is not containing parent entity?
I'm using:
Drupal 9.1.7
Commerce 2.24
I'm trying to create my custom condition (based on https://docs.drupalcommerce.org/commerce2/developer-guide/core/conditions). However parent entity is always ...
0
votes
1
answer
113
views
drupalcommerce/project-base prohibits upgrade to Drupal 9.2.4
I'm running into composer errors while trying to update a Drupal Commerce site to Drupal 9.2.4.
I'm not sure how to interpret this output when I try composer prohibits drupal/core 9.2.4
results: https:...
1
vote
1
answer
284
views
Should I remove "Commerce Base" from site before an upgrade?
The "Upgrade Status" module reports that "Commerce Base" exists in site file structure, but is not installed and suggests removing it. I expect that the Commerce project references ...
0
votes
1
answer
52
views
Mocking the response of XmlResponse::getResultCode not working
Following is the code that I'm using to mock the response of XmlResponse::getResultCode as Ok, but it isn't working, I'm not sure what exactly is going wrong here:
$response = $this->...
2
votes
1
answer
130
views
How do I get rate and configuration values?
I'm stumped. How do you get values off of the shipment method config? For example I have a the Flat Rate shipping method "Express". I want to get the raw config form values stored on that ...
0
votes
0
answers
43
views
The "Add to cart" button allows me to add more items to the cart than there are in the inventory
I am trying to work on a Drupal 8 commerce site which was built by someone else. I have not used the Commerce Core module in the past.
Product variation has stock field where I enter total inventory I ...
0
votes
1
answer
73
views
How do I fix this error about a missing class?
I'm using the Commerce Canada Post module.
The code in the src/Plugin/Commerce/ShippingMethod/CanadaPost.php file uses a CanadaPost\Rating class which isn't defined that namespace and it causes an ...