Stack Exchange Network

Stack Exchange network consists of 174 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.

0
votes
1answer
14 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....
0
votes
0answers
8 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
25 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
31 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
32 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
10 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
22 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
7 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+...
1
vote
1answer
18 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
38 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
44 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
24 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
26 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
11 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
15 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
30 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
39 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
24 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
20 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....
1
vote
1answer
38 views

Check for whole cart adjustment and apply line item discount

I'm writing a custom plugin for a customer that does 2 things. Uses prices from Pricing Categories. There are 10,000 digital products, so adjusting prices for large quantities is cumbersome on a per-...
1
vote
0answers
33 views

Setting a new / override shippingAddress via axios

I am trying to change/set a customers shippingAddress via axios It does work e.g. for setting the shippingMethod or the quantity for a product. However if i want to set a new shippingAddress the ...
1
vote
0answers
38 views

Extending Craft Commerce Purchasable Nav Items

I'm looking to extend Craft Commerce with a custom Purchasable. I'd like to implement this using a module if possible. I've implemented the base class for my new Purchasable and that's all good. ...
1
vote
0answers
15 views

Commerce Discount Issue/Discepancy

In Craft 2 Commerce 1 one could apply a coupon code with "per email limit" during checkout, without having the email added to the order/cart model(s). In Craft 3 Commerce 2 the same scenario yields ...
0
votes
0answers
10 views

Duplicate products to subdomain

I can't find this anywhere so I'm going to assume it hasn't been asked. Is there a way to duplicate my products from my primary site to my subdomain? It seems like it should have done it ...
1
vote
1answer
22 views

Get discount data from adjustment object

Is it possible to get, from one of the cart.adjustments of type discount, whether the discount was added with a coupon code, and if so, what that coupon code is?
0
votes
0answers
56 views

Commerce 2 PayPal Express — “No value passed to payment” error

I've cobbled together a combined payment screen that has both PayPal Express and Stripe forms visible, one above the other. Stripe works fine but PayPal errors with 'ppxo_no_token_passed_to_payment'. ...
2
votes
1answer
71 views

(How) can I fill a visitor's cart by using a link?

When using Commerce 2, is there a way to fill a client's cart with the contents of an (inactive) cart, by using a link? Use case: abandoned cart email.
0
votes
0answers
13 views

Sorting/Ordering states/counties in Commerce

Added a few new counties/states in Commerce, and I need them to output in alphabetical order in my checkout address dropdown. I'm not much of a Javascript guy, and can't for the life of me figure this ...
2
votes
0answers
52 views

Searching for Multiple Categories and Tags

I've been pulling my head for the past day on how to filter products with multiple categories. After a long search, I found and implemented on my project, Advanced Search with tags and categories It ...
1
vote
2answers
51 views

Frontend form to change Craft Commerce user's password?

I'm trying to modify Craft 3's example 'Change password' form to work with a logged in Commerce 2 user, and have copied that code to templates/setpassword.twig. Two problems... (1) The {{ code }} ...
1
vote
1answer
45 views

Get Commerce 2's Stripe subscription planData as object

How do I access a subscription plan's planData? Maybe as an object? I'm using Commerce 2 with the Stripe gateway. For example: {% set plans = craft.commerce.getPlans().getAllPlans() %} {% for plan ...
1
vote
1answer
44 views

Programmatically create a product using Craft Commerce 2?

The docs for v1 mention a method craft()->commerce_purchasables->saveElement(). This is omitted in the docs for v2. Does anyone know how I can create a product programmatically in PHP? $...
1
vote
1answer
46 views

Demo repo for an Adjuster module for Commerce 2?

Would it be possible for someone to create a demo of a barebones Adjuster module, similar to https://github.com/cliveportman/craftcommerce-adjuster but for Commerce 2? I'm trying to follow the docs ...
1
vote
1answer
30 views

Craft 3 Module Working but Throwing Errors in web.log

I'm seeing a lot of "Invalid argument" errors in the web.log for a "Multiple Option Variant" module I have running. It seems to be working just fine on the site, but curious as to what the issue might ...
1
vote
0answers
24 views

Product variant association

On my Products details page I have 2 selects. The 1st select list out the Primary variants. Based on the selected Primary variant the 2nd select is auto-completed in with Secondary variants that have ...
0
votes
1answer
32 views

“An error occurred while generating this PDF.” in Commerce 2

Like the title says, I cannot output order PDFs in Commerce 2 and not sure how to debug this. Anyone else encountered the same issue?
1
vote
1answer
27 views

Multiple cart fields/notes

First time using Commerce and made pretty good progress, but... I need to collect a few bits of information at the cart stage. The site is selling conference tickets, and I need to know: if the ...
1
vote
1answer
15 views

Update an order afterwards

Have to update an order afterwards cause the client can choose a retail partner. <form method="post" name="submitOrder" style="width: 100%" onkeypress="return event.keyCode != 13;"> <...
2
votes
0answers
28 views

Add custom column to the orders list page

Does anybody know if it is possible to add a column to the orders list page? I can choose the 'Foo' label, but when the page want to show the orders list I get the following error: "{"error":"An ...
2
votes
0answers
43 views

Commerce 2 Multi-site Support

I'm currently working on a multi-market Craft3 project with Commerce2. Each product can and will have a different fixed price on each page. Product A project.tld/de-de - € 120 project.tld/en-gb - £ ...
1
vote
2answers
73 views

Commerce 2 Subscription Prices

We've currently got Subscriptions setup on a site which works a charm, but my main issue is outputting the price of the subscription, after the user has subscribed. From the docs/templates I can even ...
1
vote
1answer
27 views

Get 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.
0
votes
0answers
19 views

Commerce: Is it possible to determine if a customer has used a discount?

The client would like to offer a single-use discount after the customer's first order is processed – that will be sent in an automated email when the order state changes. Is there a way to determine ...
1
vote
1answer
83 views

Using a custom Commerce 2 Adjuster in a Craft Plugin

I wrote a little commerce 2 price adjuster that works fine if i place it in /vendor/craftcms/commerce/src/adjusters/FriendsDiscountAdjuster.php and register it manually in /vendor/craftcms/commerce/...
1
vote
1answer
38 views

getTransactionByHash() must be of the type string, null given

I'm building my first Payment Gateway (offsite gateway) for Commerce 2. This one is for Moneris. I'm hitting an error when the page returns the response. Argument 1 passed to craft\commerce\...
2
votes
1answer
92 views

Is it possible to import orders into Craft Commerce?

We have to migrate a CSV dump from a Drupal commerce shop to Craft Commerce. It is important to import ‘Order Email’ / ‘Username’, ‘Order Date’, ‘Ordered Items’ (Name or ID), ‘Item Price’. Address ...
1
vote
1answer
52 views

Craft Commerce 2: PayPal Express not working - Correlation id: unknown

I try to get PayPal Express running but have quite some difficulties. I use the default templates for testing and can get through the whole checkout and payment process, but then PayPal closes and in ...
1
vote
0answers
29 views

Craft Commerce 2: Get products which are availableForPurchase

I try to get all the products of a certain category which have availableForPurchase set to true. {% set criteria = craft.products.type( 'weine' ).relatedTo( cat ).search( 'availableForPurchase:1' )....
2
votes
1answer
42 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
1answer
35 views

Is there a way to localise error messages in Craft Commerce 2?

I'm using Craft Commerce v2 on a Craft 3 Pro website. The checkout process of the shop includes a number of forms such as the ones that visitor can use to add or edit shopping and billing addresses. ...