Questions tagged [plugin-craftcommerce2]

Questions related to the Craft Commerce v2 plugin.

Filter by
Sorted by
Tagged with
3
votes
1answer
127 views

Setting Quantity Field on Subscriptions

How can I pass in a quantity value while creating a subscription? Plugin (version): Craft CMS (3.1.21) Craft Commerce (2.1.2) Stripe for Craft Commerce (1.2.0) Problem: My website allows users to ...
3
votes
2answers
79 views

Commerce 2: View all orders of a specific product?

I'm looking to generate a sales report for a specific product It should not be linked to a user's orders but just a general list of sales for that product and its variants Is this possible? Thanks
3
votes
1answer
155 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 ...
2
votes
2answers
177 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 ...
2
votes
2answers
415 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 ...
2
votes
1answer
78 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 ...
2
votes
2answers
222 views

Getting started with Craft Commerce 2 subscriptions using Stripe

I’m new to Craft Commerce and am really having trouble getting started with subscriptions. I used the example from the docs and nothing happened. When reloading the cp though, it kept telling me "...
2
votes
1answer
252 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 ...
2
votes
1answer
233 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.
2
votes
1answer
274 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 ...
2
votes
1answer
130 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 ...
2
votes
1answer
465 views

Craft Commerce 2 - get order data for plugin

I want to write a plugin which writes all the order data into a CSV file. Unfortunately the documentation for Commerce 2 isn't quite complete yet so I have difficulties to find out how to do the ...
2
votes
1answer
35 views

Is there a way to see a fields variant relation in templates?

To clarify; if I have a disabled variant, and I'm looping through categories (colors) on each product like {% for variantColor in variantColors %}...{% endfor %} which makes it still show up in the ...
2
votes
1answer
82 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
2
votes
1answer
97 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
69 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
2answers
59 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.
2
votes
1answer
142 views

Getting previous order history in a Commerce 2 adjuster

I am trying to write a Commerce 2 adjuster that will apply a discount on all items from a specific type if a customer bought a specific item with another product type in the last year as well as a ...
2
votes
1answer
75 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
1answer
63 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 ...
2
votes
1answer
49 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?
2
votes
1answer
19 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 ...
2
votes
1answer
95 views

How can I show a list of product options as checkboxes in the cart?

In my cart (Craft3/Commerce2), I need to show a line item's possible options from a checkbox field called "productOptions", and allow the user to select the desired options. Based on the Craft Docs, ...
2
votes
0answers
20 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 ...
2
votes
0answers
74 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
0answers
75 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 ...
2
votes
0answers
371 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 ...
2
votes
0answers
54 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
91 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
159 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
3answers
119 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
2answers
95 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
2answers
58 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 ...
1
vote
1answer
248 views

302 redirect when updating the cart via Ajax using Craft Commerce 2

I'm working on a site that has recently migrated from Craft v2 with Commerce v1 to Craft v3 with Commerce v2. Using Commerce v1 I was able to update the cart via Ajax and get a data object with the ...
1
vote
1answer
89 views

How can I change variant price in Craft Commerce 2 form

I want to add range field that will change price based on its value. How can I send updated price to the cart? Is there something easy like: {% set product = craft.products.one() %} {% set variant = ...
1
vote
1answer
45 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)...
1
vote
2answers
62 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
2answers
162 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
226 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
170 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
189 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
101 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
18 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
2answers
87 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
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…
1
vote
1answer
32 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
136 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
1answer
35 views

Show multiple products (urls/pages) on the front-end with dynamic titles/descriptions/meta based on a single product in Craft Commerce

I am considered the best way to set this up in Craft and how to handle this with front-end Urls, templates and routes? So I products with variants for Wheel Spacers, (Wheel Spacers are a product type)...
1
vote
1answer
24 views

How to display Craft Commerce subscription description from a linked entry

I must be missing something obvious here but I don't see any reference to this in the docs. Under Commerce Settings > Subscription plans > You can link a related entry to the Description but it is ...
1
vote
1answer
195 views

Is there any plugin for Blog in Craft 3?

I want to create a Blog website in craft cms. I would like to know, is there any plugin for Blog which we can use in Craft similar kind of WordPress?