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

Questions tagged [plugin-craftcommerce2]

The tag has no usage guidance.

1
vote
1answer
14 views

How to display the featured image on a Commerce product:

How do I display the featured image on a Commerce product: <figure> <a href="{{ entry.url }}"> <img src="{{ entry.featuredImage[0].getUrl('medium') }}" alt=""> <...
1
vote
1answer
17 views

Dynamically update line item in Commerce 2

I'm currently trying to adjust the line items in a particular cart/order after an event is triggered. I've got: use craft\commerce\Plugin as CommercePlugin; $this->requirePostRequest(); $request ...
1
vote
1answer
24 views

Donation Status Commerce 2

Currently trying to use the new Donations feature of Commerce 2 - https://docs.craftcms.com/commerce/v2/donations.html The order goes through fine and I can see the donation purchasable in the order. ...
1
vote
0answers
20 views

Create Manual Order for another customer

Is there any way for an admin to use the Manual gateway and create an order for another customer in the system? Or is the only option for the admin to Log In as User feature and go through the ...
1
vote
1answer
18 views

Craft Commerce 2 - extend Order details page

Let's say we're on the order details page with the 3 tabs - Order Details, Transactions, Status History How do I add an extra tab with content? Craft V3 / Commerce V2 Thanks
1
vote
1answer
7 views

Shipping for other category than what's set as default is not applied to total

Somehow, shipping rates are not applied to the total when checking out and paying. It does show when selecting the shipping method, but not on the final order review and is not submitted as part of ...
1
vote
0answers
11 views

Cart completed at gateway redirect issue

Recently I've found that when a customer goes to checkout and hits the craft\commerce\controllers actionPay() using a custom gateway that it's automatically marking the cart as complete. This never ...
0
votes
0answers
16 views

Looping over categories, product variants, and subsequently applying adjuster(s)?

Using the Craft 3 and Commerce 2 APIs, how would one go about looping through products in the cart to apply adjusters, looking at the following example; A category, "Product Packs" is set up where ...
0
votes
0answers
22 views

Create different types of Donation purchasable? (for Gift Aid etc)

The new donations purchasable looks super handy for charity websites, thank you for this :) In the UK we have a thing called Gift Aid that allows charities to claim an extra 25% on donations/...
1
vote
1answer
27 views

Order Adjusters in Commerce 2

In Craft Commerce 1, there is documentation on how to re-order adjustments that do similar things. https://docs.craftcms.com/commerce/v1/adjusters.html#ordering-adjustments But I don't see any ...
1
vote
1answer
19 views

Mark a cart as complete from a plugin

How do I mark a cart as complete from a plugin? I tried setting isComplete = 1, it gets moved to orders but it is still a cart.
1
vote
1answer
21 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
29 views

Product Combination Discount in Commerce 2?

Is there a way to set a discount in Commerce 2 that applies when, for example, three various products are in the cart? Use case; Say you have a blue shirt, a black pant and a red cardigan, in the ...
2
votes
0answers
28 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
0answers
29 views

XMLHttpRequest Craft Commerce Cart Update Issues

When using XMLHttpRequest to update cart like the following, I get a 500 error for 'lineItems': {[lineitem]: {'qty': value}} (and also {[lineitem]: {'remove': true}}, any other submission works); var ...
1
vote
1answer
17 views

How to access a digital products information on the products page in Craft Commerce?

I have created a digital product type and a digital product but strangely on the digital products template I can't access any information regarding the product like for example, entry.title. I'm ...
1
vote
1answer
21 views

How to set Commerce 2 confirmation email in .env file?

We're just in the process of upgrading from Craft 2 with Commerce 1 to Craft 3 and Commerce 2. One of the issues we had before was that the client was getting confirmation emails for test orders. Is ...
0
votes
0answers
17 views

Craft 3 with Craft Commerce not cleaning up deleted products correctly

We have a Craft 3 install with the "Try" version of Craft Commerce. When we have a product type with variants we seem to be having issues with products cleaning up correctly after they have been ...
2
votes
1answer
78 views

Selling tickets to repeating events with Commerce (and Solspace Calendar?)

We need to build a ticketing system for venue tours, that happen every week within certain date ranges, and with an option to exclude specific dates from the availability list. Looking at Solspace ...
0
votes
0answers
22 views

Is it better to let Craft handle my API calls instead of recreating the same functions

First of all, I am just a student so please go easy on me. I am creating my first API for Craft cms and Commerce for an Android application. The steps I did was as follows: I created a plugin and ...
1
vote
0answers
19 views

How to keep a users cart active after logout - Craft Commerce 2

How do I set the cart to save / stay active in a users account. When I add some products to my cart (when logged in) and logout or close my browser the next time I come back my cart is empty. I'd like ...
1
vote
0answers
16 views

How to modifyPaymentRequest() in Commerce 2?

Looks that I really used every functionality in my plugin that changed or has been removed in Commerce 2. :( I need to modify paypal transactionId and description what i did as follows in Commerce 1: ...
0
votes
0answers
7 views

No EVENT_DEFAULT_ORDER_STATUS in craft\commerce\services\LineItems?

The Commerce 2 docs shows LineItems::EVENT_DEFAULT_ORDER_STATUS as a parameter for the event beforeSaveLineItem and afterSaveLineItem, but craft\commerce\services\LineItems did not have a constant ...
1
vote
0answers
13 views

What are the replacements for the order events onBeforeAddToCart and onBeforeGatewayRequestSend in Commerce 2

I'm looking for replacements for the events onBeforeAddToCart and onBeforeGatewayRequestSend. I used onBeforeAddToCart to prevent the user from adding an article from different article groups to the ...
1
vote
1answer
80 views

Product Filtering with Tags

I've built a product filtering system using tags and currently have 2 available tag groups under different fields. Size and Type Currently if I select 1 tag from both size and type, it shows all ...
1
vote
2answers
20 views

TwigExtension added to Craft don’t work in emails

I added tomodomo/twig-pluralize-extension to my project composer, loaded with a custom module like that : if (Craft::$app->request->getIsSiteRequest()) { // Add in our Twig extension $...
1
vote
2answers
22 views

Skipping the shipping part for custom virtual product

We've a WIP that need virtual products. Not the official plugin, but a custom product type that don’t required any shipping. I was wondering if anyone ever try to do so, and how. I was thinking about ...
1
vote
1answer
25 views

Upgrading Commerce 1 to Commerce 2

Folks: I've got an e-commerce site that I'm upgrading. I've upgraded to Craft 3 and can reach the CP and the home page. This site is tightly integrated with Commerce 1. When I visit the plug-in page,...
1
vote
0answers
19 views

Commerce 2 Subscriptions (Using Stripe API)

I'm currently trying to implement and understand how Subscriptions work on Commerce 2. I'm using Stripe API and have created the subscriptions on their CP. I've listed them on my shop page and added ...
2
votes
2answers
52 views

Craft Commerce 2.0.2 Shipping Rule Names & Descriptions—How?

I just noticed I had to update some templates after updating to the latest Commerce version (2.0.2). How does one go about getting the method's rule description? I currently have it set up to apply ...
1
vote
1answer
16 views

Getting orders by property in Commerce 2 from Plugin

In Commerce 1 i can select orders by a specific property as follows: $criteria = craft()->elements->getCriteria('Commerce_Order'); $criteria['orderStatusId'] = 1; return craft()->elements-&...
1
vote
2answers
52 views

DB Queries in Craft Commerce 2 with large data

Currently working on an e-commerce site, which currently has over 4000 products with a mass of variants (averaging 3 variants per product) - and hit a few hurdles on the way... At present, craft....
1
vote
1answer
29 views

How to get core shipping methods in Commerce 2? How to save an order?

Is there an equivalent function to commerce_shippingMethods->getAllCoreShippingMethods() in Commerce 2? I can only find Commerce::getInstance()->getShippingMethods()->getAllShippingMethods();...
1
vote
1answer
41 views

Get all variants from multiple products

I need to get a list of variants from multiple products, but in a way that allows us to show the results in Craft's handy {% paginate %} tags. So far we have this less-than-appealing markup: {% set ...
-1
votes
1answer
46 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 ...
2
votes
0answers
49 views

How best to add price tiers based on user group

I'm new to Craft Commerce. I wish to add around 10 price tiers to each product. Users are in groups and the group determines which price tier they pay. All the data is to be imported (and kept up to ...
1
vote
1answer
11 views

What happened to commerce_discounts->saveDiscounts or How to relate vouchers to product types in Commerce 2?

We sell vouchers to our shop users. To prevent them for being used on vouchers themself, i could relate them to specific productTypes or even products in Commerce 1. craft()->commerce_discounts-&...
1
vote
1answer
26 views

Correct way to getOrderByNumber() from my Plugin in Commerce 2

I am migrating my plugin to Craft 3 / Commerce 2. What is the best way to call another plugins method like craft()->commerce_orders->getOrderByNumber($number) from my plugins service?
1
vote
0answers
8 views

Paginate a list of product variants with categories parameters

I have got a category multi-select feature that allows users to filter variants by more than one category. On selection the URL is concatenated as a new category as follows: ?cat=blue ?cat=blue+...
2
votes
1answer
22 views

Update an order custom field after order complete in Craft 3

I am trying to update an order's custom field after order complete. I set it like this in my plugin: Event::on(Order::class, Order::EVENT_AFTER_COMPLETE_ORDER, function(Event $e) { $order = $...
2
votes
1answer
44 views

Order products by lowest product variant

Currently using Craft Commerce 2. I was wondering if it's possible to order products by the lowest priced variant. I have tried something along the lines of this, but it doesn't do anything ...
2
votes
1answer
68 views

Exposing current Commerce2 Cart via the Element API

I want to be able to retrieve the current users Cart via a JSON API endpoint, so I can loop through the products in the cart in JS on the front end. I've got the Element API plugin installed, but I ...
1
vote
1answer
26 views

Accessing Commerce product variant dimensions in the template

I have been unable to locate anything in the docs or any questions on here regarding how to print the dimensions associated with a variant in the template. All I have managed to find is how to print ...
1
vote
2answers
30 views

Possible to paginate product variants in Craft Commerce 2?

I am currently in the process of building a commerce 2 site with a very detailed level of nesting in the product options so we're looking to list all variants for a product. (Sounds silly, but it ...
2
votes
1answer
12 views

Including a variant segment in product type template route in Commerce 2

Is it possible to use a wildcard when specifying the template path for a Commerce 2 product type? I want to format my URLs as /type/product/variant Where 'variant' could be a custom field applied to ...
1
vote
1answer
19 views

Check if title field has a string in ElementAPI

I am trying to retrieve search suggestions for a search form. I sent the parameter entered by the user, but how do I do it in the criteria? I tried this: 'criteria' => [ 'search' => 'title: ...
1
vote
1answer
82 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 ...
1
vote
1answer
58 views

How to debug a payment gateway error

I created a payment gateway for Commerce 2. When I try to make a payment, an error happens and the flash error I get is this "Invalid payment or order. Please review.". I don't know if my gateway is ...
1
vote
1answer
38 views

Commerce 2 Stripe gateway seems to be working correctly, but order remains unpaid

I am using the Stripe gateway plugin for Commerce 2. I have done the following: Entered the stripe API keys correctly. Set the Webhook URL up correctly in Stripe. Correctly disabled CSRF protection ...
1
vote
1answer
31 views

Hide or obfuscate Digital Product file path?

What's the best way to hide the URL from the user/browser task bar? The only way I can get the link to work for a customer is to select the "Assets have public URL", which I really would prefer not to....