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-craftcommerce]

Use this tag for questions relating to the Craft Commerce product.

1
vote
1answer
20 views

Get a specific product with Element API, Commerce and Craft 2

How do I get a specific product via Element API? Here's what i have so far 'api/product' => function() { $productId = craft()->request->getRequiredQuery( 'productId' ); return [ ...
1
vote
1answer
13 views

Get and display a product's variant fields in twig

I'm working on a product template that can display products of any type. Various product types have varying numbers of variant fields each with their own options as other products. (All of my variant ...
3
votes
1answer
57 views

Craft Commerce - Different confirmation email address for different product types or category

On a website I will be setting up there will be different ranges/types of products. Basically purchased from different departments within the organisation. I can filter the products in different ways ...
0
votes
0answers
23 views

Craft Commerce Stripe Not Creating Subscriptions

I have the following code trying to sign up someone to a subscription plan using Stripe Commerce. Unfortunately, no subscriptions are getting created in Stripe Test and no errors are getting given. {%...
1
vote
2answers
121 views

Error with Craft Commerce & Stripe no longer supports API requests made with TLS 1.0

I am using the code from the example templates to integrate a simple stripe pay button on a commerce site: <form method="POST"> <input type="hidden" name="action" value="commerce/payments/...
0
votes
0answers
16 views

Custom payment gateway adapter for Commerce 1

I've built a custom payment gateway to integrate with a vendor that provides options to pay off-site, on-site and also to load the off-site payment form into an Iframe to kind of simulate on-site. I'...
0
votes
0answers
21 views

How can I overwrite the search page within a plugin?

My first day with Craft. I want to create a plugin that will provide a Product Query (collection, Craft Commerce) based on some 3rd party search (like Algolia). How can I overwrite the route search?...
-1
votes
0answers
14 views

Print to Console Inside Event

I created a CUSTOM PLUGIN and I have the following code: Event::on(FOO::class, FOO::EVENT_NAMED_BAR, function(Event $e) { $message = "Hello world"; // craft::error( $message ); // ...
1
vote
0answers
33 views

Is it possible to change the group that a user belongs in the front-end?

A little background: The website runs on Craft v.3 Pro and Commerce v.2 Pro The user can register as a member from the front-end. They will be able to select only one of 3 different groups to ...
3
votes
0answers
385 views

Currency switcher

Folks: I'm setting up a multi-currency site (CAD, USD, EUR). I'd like the user to be able to select their currency before they actually put anything in the cart. And once selected, prices throughout ...
1
vote
0answers
11 views

Line item not found when trying to remove item from cart

I'm trying to remove a product from a cart but i'm getting an {error: "Line item not found"} error and I can't figure out why. Here is my code: $('.js-item').on('click', function(e) { e....
0
votes
0answers
9 views

Missing address and shipping info

Folks: I've had a site up and running for some time. All has been well until a recent move to a new server. Since the move, a very small percentage of transactions are coming through with no ...
6
votes
3answers
873 views

Craft Commerce: Validation on Address Fields

Can someone break down how I should validate empty address fields as a plugin for Craft Commerce and take the following answer further? The Craft Commerce documentation provides the following example ...
1
vote
1answer
30 views

Custom Plugin for ZenDesk Tickets [closed]

I need all of the custom fields on an order submitted to ZenDesk to create a new ticket once the order is completed. Once a ticket is created in ZenDesk, we will need the ticket number saved on a new ...
1
vote
1answer
17 views

Individual persistent property per item in stock

This is more advanced: We want to sell activation keys for digital products. We know that in Craft a variant has a stock. So every single item "in" the stock needs a unique activation key. When we ...
2
votes
0answers
31 views

Creating multiple plan subscriptions

Versions: - Craft CMS (3.1.21) - Craft Commerce (2.1.2) - Stripe for Craft Commerce (1.2.0) Problem: - My website offers user's ability to subscribe to several subscriptions at the same time. ...
1
vote
1answer
26 views

CDbTransaction is inactive and cannot perform commit or roll back operations

Folks: I've been running this site for 2 years without issue but today, this cropped up: "CDbTransaction is inactive and cannot perform commit or roll back operations." This occurs when adding a ...
1
vote
1answer
25 views

Clear template cache after update sale on Craft Commerce

How can I clear products template cache after update sale ? Because product price don't change ... Thank you.
14
votes
1answer
676 views

Issues with Craft Commerce and VAT taxes

We've just completed our first Craft Commerce website at Base Design. Overall everything went well but we encountered issues with taxes and the way VAT works on online sales in the EU. Craft Commerce ...
1
vote
1answer
17 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
34 views

Unexpected token “name” of value “name” (“end of statement block” expected)

Internal Server Error Unexpected token "name" of value "name" ("end of statement block" expected). Getting this error on my commerce/products template. What am I missing? {% extends 'shop/_layouts/...
1
vote
3answers
299 views

How can I update a custom Order field in a plugin controller?

I have a custom plugin in which I have a controller action which I want to validate some values and then update a custom field on the Cart. I can get the values from the form and validate them, I'm ...
1
vote
1answer
73 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
36 views

Craft commerce and invoices

In general what is the best practice to handle invoices from orders made in Craft Commerce ?
1
vote
0answers
15 views

Exclude User Group from Sale

Is there a way to exclude a User Group from a sale? We have a trade user account that applies a flat 20% discount across all products but we're trying to run a different sale for all customers on a ...
1
vote
1answer
38 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
1answer
32 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
21 views

Add attachments with Craft Commerce

Suppose I have an assets field in my orders fields, how could I attach those files in the confirmation email?
2
votes
2answers
556 views

Craft Commerce Required Address fields

I need to make the address fields in craft commerce required, as well as the phone number, etc. I tried to add the 'required' tag to the input element, but it breaks the form so you can't submit it -- ...
1
vote
1answer
40 views

Localization - “not found” in CP on language selection

Folks: I'm creating a localized site on Craft2 and CraftCommerce. I have followed the instructions for creating a localized site but none of the content shows at the localized URL and the homepage ...
1
vote
1answer
47 views

Get only enabled variants of a product

I would like to get all enabled variants for a product. I refer to the following question, where a method for limiting a for-loop is given: Disabled product variant still shows in {% for %} loop In ...
1
vote
1answer
24 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 ...
1
vote
1answer
85 views

Craft Commerce multisite, different tax rates

In Craft 3, Commerce 2 is there a way to set a different tax category or rate on a cart/site when using commerce in a multi site environment? Site A (b2c website) has tax rate 1 (21% with tax included ...
1
vote
2answers
25 views

Commerce 1 get customer from user model

In PHP, is it possible to grab the customer model from a user model? EDIT: I just noticed that it is possible to attach a customer info field to the user. How do we achieve this?
0
votes
0answers
23 views

Commerce 1 create a new order programmatically

How can this be done in PHP? I can't find anything in the docs.
1
vote
1answer
48 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,...
2
votes
0answers
31 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
1answer
72 views

Simple webshop solution (Craft Commerce)?

I am looking for a simple shopping solution for one of my customers. Since their website is already running with CraftCMS, I am looking if there is any integrated solution available. However, so far ...
-1
votes
1answer
24 views

Craft Commerce - empty cart.adjustments data

I'm having a Craft Commerce issue receiving cart.adjustments data in my twig templates. I've created a shipping category and shipping method with a rule to add a base rate of $10 to every order, but ...
1
vote
1answer
61 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
vote
0answers
50 views

Get field type of product or variant with element api

Trying to get type of a field (dropdown, checkbox, etc) to render those fields in app, there is all sorts of info available in $variant->fieldLayout->fields like handles, values, ids except type ...
1
vote
2answers
59 views

Can I set a Commerce order custom field from a plugin

On a site with Commerce 1, I have set up some custom fields for order related data. I can set them using form inputs like so: <input type="hidden" name="fields[myCustomField]" value="1"> I'd ...
1
vote
1answer
21 views

How to get instance of DiscountModel in Commerce 2?

In Commerce i got an instance of DiscountModel Class as follows: $discount = new Commerce_DiscountModel(); Is this the right way in Commerce 2? use craft\commerce\models\Discount as DiscountModel; ....
1
vote
0answers
25 views

Shipping and billing addresses dissapear when close and open the page

I have the following problem. When I set shipping and billing address on my cart and exit the page, the addresses are cleared once I open the page again. Is it possible to disable this behavior? ...
1
vote
0answers
11 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
74 views

Same-page checkout

I'm having a very hard time making a one-page checkout. What I actually want is: automatically add the item to the cart. The cart can only contain one item. On the product page (that automatically ...
1
vote
1answer
47 views

Trying to automatically add a product in Commerce

I'm trying to add a product to a cart (and emptying the cart first) if a user just visits a template. My goal is to make a one-page checkout: so I want the address info on the product page itself. ...
1
vote
1answer
45 views

Modify Order table in Control Panel

I need to add and/or change an attribute in the order table on /admin/commerce/orders. The Order Element itself does not have a EVENT_SET_TABLE_ATTRIBUTE_HTML, and I've tried with variations like ...
0
votes
1answer
148 views

Need somebody to help us with our existing Craft web page [duplicate]

Our developer has disappeared and we need some help in changing and adding a few things on our website (www.fincarosablanca.com)? Would like to have somebody in Costa Rica but it doesn't really matter....
1
vote
2answers
36 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 ...