Questions tagged [plugin-craftcommerce2]

Questions related to the Craft Commerce v2 plugin.

Filter by
Sorted by
Tagged with
0
votes
0answers
7 views

How to exclude multiple email addresses from an order query

When doing an order query I want to omit results for 2 particular email addresses. It's easy enough to omit results for one address; $order = Order::find() ->isCompleted(true) ->email('...
0
votes
1answer
39 views

How to identify the recurring payments that happen after the initial subs creation payment the in Commerce Subs

I've got a custom module that I have written to inject data into various places in my site when events happen with Commerce Subs. As per the question title, I need to update an entry when a recurring ...
1
vote
1answer
30 views

How do I apply taxes to subscriptions with Stripe plugin?

I need to apply taxes to subscriptions. How do I do that? The idea is that prices are first shown without taxes. Then – on the payment page – I need some kind of "bill" that shows all the relevant ...
2
votes
2answers
60 views

How to get all users with active Commerce 2 subscription

How do I get all the users with an active subscription in Commerce 2? I want to be able to filter entries by subscribed users.
1
vote
1answer
21 views

Show custom fields on cart

I'm trying to show custom fields on the cart but I'm missing something (and new to Commerce, so bear with me). When I output {% for lineItem in cart.lineItems %} within my {% for item in cart....
1
vote
1answer
14 views

Available Shipping Methods Returns Null

I have created a shipping method in the CP but when I output cart.availableShippingMethods a null value is returned. I've checked my database and the shipping method is there. Is there something I'm ...
1
vote
2answers
102 views

Commerce 1 with Apple Pay, is it possible?

We are using Stripe on our website. Craft CMS 2.6.2997 and Commerce 1.2.1351. Can we use the apple pay function? I read the Stripe document(https://stripe.com/docs/stripe-js/elements/payment-request-...
1
vote
1answer
9 views

Getting adjustment amount in a plugin

I need to get the amount of a discount from orders to write that data into a json file (on EVENT_AFTER_COMPLETE_ORDER) which then will be consumed by an inventory management system and now am stuck ...
0
votes
0answers
14 views

Funky Shipping, Requiring Cart Updates

So we have a shipping logic on a site of (yes, that way round) < £5.00 => Shipping = £0.00 >= £5.00 => Shipping = £2.50 Currently, we have an issue where sometimes shipping is set to £5....
1
vote
2answers
63 views

Get last item added to cart

Does anyone know a nice way to get the last lineItem(s) added to a cart in craft commerce via twig template? Example use case, an 'added to cart' confirmation page. I know for this you could query ...
1
vote
1answer
41 views

Get address data of Order

This used to work in commerce 1: {{ order.billingAddress.firstName }} within a for loop of craft.orders.all(). No longer in Commerce 2. If I use this syntax I get Impossible to access an ...
1
vote
1answer
31 views

Commerce 2 Sales Not Present In Cart lineItems

I have an issue where sales and sale pricing seem not to be present in the cart. This is on an ecommerce flow where this was previously all working but I had moved onto other dev work on this site for ...
1
vote
0answers
11 views

How can I search for Craft Commerce orders with a specific product?

Is it possible to narrow the order query from the default order listview in the CP from Craft Commerce? Because I’ll want to show all orders with a specific product so I can export them.
0
votes
1answer
452 views

ERR_EMPTY_RESPONSE when accessing order data (MAMP)

I've got a local installation of Craft 3.0.37 and Craft Commerce 2.0.0-beta.15 running on MAMP. When completing an order, an empty response is given by the browser. The same thing happens when trying ...
1
vote
2answers
89 views

Flat pricing for different currencies with sales

I am trying to implement flat pricing for Craft (ie. different fixed prices for products, based on the currency). I have it working thanks to this post (Craft Commerce: Hard code different product ...
0
votes
0answers
30 views

How to save a product via PHP in Commerce 2?

I'm trying to save a new product with variants via PHP. $product = \Craft::$app->elements->createElement(\craft\commerce\elements\Product::class); $product->typeId = 1; $product->enabled =...
0
votes
0answers
12 views

Twig Shipping same as Billing Address

Is it possible to write a twig conditional if the Billing Address is not the Same as the Shipping address? {# something like #} {% if order.shippingAddress is the same as the billing address %} {...
1
vote
0answers
12 views

How to fetch products related to every product within an array?

I’ve got products which are related to various products of another type (product.accessories). Now I’m trying to fetch all products related to every single product within a given array. My first ...
1
vote
1answer
17 views

$order->dateOrdered returns a string value the first time and DateTime after that. [Order got through event]

I am using the Commerce 2 plugin and I am experiencing a very odd issue. Once an order is complete I want to use the dateOrdered property to create a csv which I send through a request endpoint. That ...
1
vote
1answer
44 views

Mandatory order fields in Craft Commerce 2

Ist it possible to add validation rules for Carts/Orders? I need to check whether there is at least one list item added to the cart before payment is initiated. Unlike addresses (Address::...
0
votes
0answers
21 views

Commerce 2: multiple carts or wishlist

Is it possible to have multiple carts in Commerce 2? Like having a normal cart and e.g. wishlists for certain occasions. On the product page you can decide to which cart you want to add your item.
0
votes
1answer
29 views

How do I pass custom field contents from cart to order

cart.billingAddress and cart.shippingAddress are both are set to the same address and include custom1 and custom2 fields. After submitting the order, order.shippingAddress and order.billingAddress ...
2
votes
2answers
451 views

Customizing Stripe payment form for Craft Commerce 2

Where does one start with matching the style of the Stripe payment form to the rest of the site? Using Stripe for Craft Commerce Plug-In {{ plan.getGateway().getPaymentFormHtml({})|raw }} This ...
1
vote
1answer
30 views

Get products that are in stock

In Craft Commerce 2, how can I query products that are in stock? These are products without variants. Edit: Perhaps this is a Craft-bug? This particular product type used to support variants - but ...
1
vote
0answers
53 views

Customize Stripe payment intent forms when using Stripe for Craft Commerce (commerce-stripe) plugin [duplicate]

Is it possible to style the fields contained in the Stripe Intents form when using this plugin? Currently the form seems to load with all the interactions but with minimal styling. I'd like to have ...
0
votes
0answers
25 views

How to do smart upselling and cross-selling in Craft Commerce

I want to have the following features on my Craft Commerce site: Often bought together: Bundling You may also like: Upselling/cross-selling/personal recommendations Accessories I realize that it's ...
0
votes
0answers
16 views

Cart total before shipping and tax (but with discounts)?

Wanting to check this out but it appears that there is no property or method to get a total of all lineItems in a cart plus any discounts (so without any tax or shipping (ie. other adjustments)). It ...
1
vote
1answer
10 views

Craft Commerce > 2.2: How can you order line items?

As of Commerce 2.2 line items are ordered by date created. How can you order line items differently? {% for item in cart.lineItems.orderBy(’sku desc') %} does not work…
0
votes
0answers
11 views

Set the redirect url for a request from a plugin

I implemented an API for my Craft 2 site, One of the requests requires me to open a webview where the user can fill in some forms. What happens is that he enters some info from the app that will be ...
0
votes
0answers
20 views

Commerce payment currencies

admin/commerce/store-settings/paymentcurrencies There is no Croatia on currency list HRK How to solve that... Is it possible (in Craft Commerce V2) to have multi STOCK location fields for products ...
1
vote
1answer
29 views

Recommended way to organize product types and fields in Craft Commerce

I am setting up a Craft CMS site with Craft Commerce for a B2B-customer. Here is a little excerpt of their product type hierarchy: Textile Sewing machines Heavy Duty Machines Furniture machines ...
2
votes
1answer
79 views

Payment currency not allowed

Craft 3.3.8 Commerce 2 Lite Version If I change the base currency from default(USD) to NZD or AU in the setting CP > Commerce > Store Settings > Payment Currencies and browse to /shop/ or ...
1
vote
1answer
34 views

EVENT_AFTER_CREATE_SUBSCRIPTION can someone confirm this means successful purchase?

Regarding Event: EVENT_AFTER_CREATE_SUBSCRIPTION https://docs.craftcms.com/commerce/api/v2/craft-commerce-services-subscriptions.html#events The document states "The event that is triggered after a ...
1
vote
1answer
22 views

How to toggle main product image from multiple images

I'm having some trouble figuring out how to properly update the main product image from a set of images that are available. Within the product detail page, I have a large default image that is shown ...
1
vote
1answer
26 views

Having issues looping through variants for Commerce 2 Products using Element API

I'm currently able to return the first variant using the following: <?php use craft\commerce\elements\Product; use craft\helpers\UrlHelper; return [ 'endpoints' => [ 'products.json' =>...
0
votes
0answers
15 views

How-to display a specifc optgroup from a field

based on "how-to display a dropdown field wth optgroups", I would like to display only labels of a specific optgroup. Any suggestens how to do that? Thanks.
1
vote
1answer
14 views

Rounding down issue with commerceCurrency filter

We have a site-wide sale on with 10% off products. On the category/detail page the commerceCurrency filter appears to round down, but when a customer adds an item to the basket, it's shown correctly ...
1
vote
3answers
120 views

How to display payment gateway error message only

I am trying to display the error message coming from the payment gateway ONLY. I know I can use {% set message = craft.app.session.getFlash('error') %} {{ message|length ? message }} but commerce ...
1
vote
1answer
24 views

Craft Commerce: discount taxation

Is there a way in Craft Commerce to apply discounts to the net order total (eg the subtotal/before tax is applied to the order)? Out of the box this seems to discount from the basket/order total.
1
vote
0answers
19 views

How can I show only the sale discount applied to a completed order

I have two orders for the same product. One placed with a sale on the product enabled and the other with the same sale on the product disabled. On the order details template for customers I have the ...
0
votes
0answers
11 views

Commerce preferred currency - user/customer setting

Is there a way for users/customers to set a custom/preferred currency that would be applied to any future carts (assuming more than one currency was available)? Was looking at whether could do this ...
1
vote
0answers
23 views

Getting value from response (Craft Commerce)

I'm in the process of adapting the old RealEx gateway to work in Commerce 2 since that's what we're using and there isn't native support in V2. I've got payments and 3D secure working, now I'm trying ...
0
votes
1answer
24 views

Is it possible to add to cart with a radio input rather than a select?

I'd like to add a digital product to the cart using a radio input but all the template examples I see use select. Is it possible to use a radio input? With Select (working): <select name="...
1
vote
1answer
140 views

Can I call a dynamically named variable through twig?

I am using Craft 3 with the Commerce 2 plugin. I am trying to dynamically call a variable in a twig template where this variable has to be a "placeholder" for a handle of a field inside a block ...
1
vote
0answers
21 views

Order history access item/cart totals in payment currency

I'm a bit confused at how to show previous orders taken in another currency. For example, if I take a payment in EUR but my default currency is GBP the order price (eg subtotal, tax, total, etc) are ...
0
votes
0answers
24 views

Craft Commerce 2 order payment debugging

The payment form works fine with a dummy gateway, but when I switch to the Mollie payment gateway (live key) the payment form just refreshes the page. The error flash is "Invalid payment or order. ...
0
votes
0answers
27 views

Worldpay integration: Craft Commerce

Am testing a sample checkout page in Craft Commerce 2 with Worldpay. The JS iframe is loading into the page fine and when I enter sample card details I can see in the browser inspector that when I ...
1
vote
1answer
41 views

Craft 3 / Commerce 2 + Multisite & COMMERCE_PAYMENT_CURRENCY

I've just done a Craft 2 > Craft 3 upgrade, and it previously used different locales to change the default currency, depending on the locale. In Craft 2, I would set COMMERCE_PAYMENT_CURRENCY in my ...
1
vote
1answer
26 views

Craft Commerce: fixed product variants/multiplier

We have a client that is selling products with fixed rate variants. In other words so that the base cost is the only price defined whilst others are based on a globally defined multiplier, eg. 1.5x or ...
1
vote
1answer
46 views

Commerce 2 Adding tax to custom adjuster

I have created a custom adjuster, there is a surcharge per item if a customer has selected rush delivery. But i need to charge tax on that adjuster. Below is code: public function adjust(Order $order)...