Stack Exchange Network

Stack Exchange network consists of 175 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange

New answers tagged

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


0

I've managed to create new payment and modify authorisation amount. Here is what I have so far: public static function getSubscribedEvents() { $events = ['commerce_order.place.post_transition' => ['captureFee', -50]]; return $events; } public function captureFee(WorkflowTransitionEvent $event) { /** @var \Drupal\commerce_order\Entity\...


0

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" ], "...


0

It turns out that I had to add a relationship to Product Variation Type in order for those fields to show up. Hope this helps others!


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


0

Found a solution! Add a field of type "Product reference" to the Product content type ("Inline entity form - Multiple values" as widget) Use "Add to Cart Form" to its display format Field API in node--product-display.tpl.php: print render($content['field_info_prodotto']);


0

It seems duplicate of https://stackoverflow.com/a/56225927/7528823 or please see the documentation --- Creating Products


0

A variations tab, which is skus and prices. A product is paired to 1 or more variations. Answer provided by smccabe from commerce slack.


0

As the top line suggests $purchased_entity is of of type "Drupal\commerce_product\Entity\ProductVariation" which is basically an entity. All entities have a ->get('field_name') method. So for your example to get 'field_order_no' you would do $order_no = $purchased_entity->get('field_order_no')->getValue(); You can retrieve the value of any field ...


Top 50 recent answers are included