Questions tagged [plugin-craftcommerce2]

Questions related to the Craft Commerce v2 plugin.

Filter by
Sorted by
Tagged with
0
votes
1answer
698 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
1answer
81 views

Craft Commerce Delete Customers

Is there a way to delete the users that were created in the customers section? I made a site and generated multiple accounts for testing purposes, but now I have to deliver it and I don't want those ...
0
votes
0answers
41 views

Why does a cart get added with no Order Number?

Sometimes, the cart gets added without the id as below. Any ideas, please? (Craft Commerce version is 2.2.19)
1
vote
1answer
31 views

Add items to user's cart in Craft Commerce 2

I'm trying to add items to user's cart from a plugin but I'm stuck on getting cart of a user other then current user. I have the code for adding items to cart, it's something I used on current user. ...
0
votes
0answers
43 views

Changing URL format in craft commerce products error 502

I have more than 150k products on craft commerce, and i need to do some changes in the URL format, but when i click save, the server returns a 502 error. I think that is because craft is trying yo re-...
1
vote
1answer
52 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' =>...
2
votes
1answer
609 views

Getting Commerce Products using Element API in Craft 3

I am trying to get Products using the Element API plugin. I set the 'elementType' to Commerce_Products, CommerceProducts, etc.., but the endpoint keeps returning: Endpoint has an invalid ...
0
votes
0answers
14 views

Error when trying to access 'variables' inside the PDF template in Craft Commerce

I'm trying to include the custom image field inside the PDF file of Craft Commerce. I added the following code to the module: use craft\commerce\events\PdfEvent; use craft\commerce\services\Pdfs; ...
2
votes
1answer
97 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
11 views

Lineitem language not correct

I have a multisite and it seems that the lineitems are always saved in the default site's language. When I loop over order.lineitems the item.description isn't translated. When I look at the order in ...
2
votes
2answers
132 views

Unable to register adjuster in module

Following https://docs.craftcms.com/commerce/v2/adjusters.html I am unable to register an adjuster in my module. in my Module.php file I have placed the following inside init() alongside other stuff ...
1
vote
1answer
78 views

Empty cart should remove coupon discounts in commerce

Is there anyway to remove all the discounts if cart becomes empty?
1
vote
1answer
28 views

How to add custom options or fields to an Order Adjuster?

How do you add options or custom fields to an OrderAdjuster in Commerce 2? I'm migrating a website from Craft2 to Craft3 and need this, this is how I do it in Commerce 2: $promotionsAdjuster->...
1
vote
1answer
137 views

Tax validation in Craft Commerce

We have a single page checkout where the items are selected and addressed added before going to a cart summary page showing amount owed and tax due. Was confused as to why certain codes were not ...
2
votes
1answer
317 views

Commerce: what is the purpose of a line item's snapshot?

Having nearly completed my first real Commerce project, I managed to utilize most of the features offered in Commerce 3. However, I never quite figured out what the use of a line item's snapshot is ...
2
votes
1answer
419 views

User-determined price for a product variant?

Is there a way in Craft Commerce 2 to have a user-input price as a product variant? In my case, I'm offering several pre-set amounts for a donation product (each is a variant), but I also want to ...
1
vote
3answers
442 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
27 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('...
1
vote
1answer
77 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
270 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
120 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
47 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
44 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
234 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
12 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 ...
2
votes
2answers
227 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
65 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
82 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
29 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.
1
vote
2answers
200 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 ...
1
vote
0answers
23 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
24 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
58 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
1answer
46 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 ...
3
votes
2answers
1k 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
222 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
160 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 ...
2
votes
1answer
107 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
25 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
54 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
144 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
97 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
40 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
25 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
1answer
76 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
33 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 ...
1
vote
0answers
40 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
30 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
940 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
25 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 ...