Questions tagged [plugin-craftcommerce]
Use this tag for questions relating to the Craft Commerce product.
857
questions
0
votes
0
answers
7
views
Craft Commerce 5: Dynamically Update Variant Price and Stock
Just before the payment step, I need to check the prices and quantities of the products in the cart.
The reason is that we use an external database (physical store) where prices and quantities are ...
1
vote
1
answer
12
views
Edit line items on front-end once order is placed
When I post an order, in the line items I give it a few custom option with it like palletAmount, palletCost, queueOrder, ... Once the order is placed, how do I edit these in the front-end again?
I ...
1
vote
1
answer
13
views
Craft Commerce 5: Displaying Additional Shipping Method Details
In Craft Commerce 5, when selecting a shipping method, I list the available options using cart.availableShippingMethodOptions like this:
{% for handle, method in cart.availableShippingMethodOptions %}
...
1
vote
0
answers
28
views
Filtering Craft Commerce products by all variant prices with pagination
I'm working with Craft Commerce 5 and need to filter products based on the prices of all their variants while also using pagination.
Requirements:
Filter products by the prices of all their variants (...
1
vote
0
answers
37
views
Is there a way to place an order (as admin) in name of a customer in craft commerce?
Like the title suggest. I would like to place an order in name of a customer with an admin account on the frontend. Just like in the backend you can make a manual order by first selecting a customer ...
1
vote
1
answer
25
views
Add shipping address to user on registration
I am working on a craftcms + commerce project and I need to add a shipping address to new user during its registration process. The idea is to have a shipping address added to any newly registered ...
1
vote
1
answer
23
views
How to add a 'Share Cart' button to send email to customer with cart link
I'm looking for the best way to add a 'Send Cart Link' button to the Order entry view in Commerce 4/Craft 4.
Currently the 'Share Cart' link is behind the cog in the top right of the order view. This ...
0
votes
0
answers
40
views
Product Bundles on Craft 5
What is the best way of creating product bundles on Craft 5? Either by sending a singular bundle ID as a group or by sending multiple individual products?
1
vote
1
answer
29
views
Change email transport settings based on order site
I've been trying to send Commerce emails via two different domains but I'm having very little luck getting it working fully.
In app.php I have something like this:
'mailer' => function() {
$...
1
vote
1
answer
37
views
Why am I seeing a version compatibility error after updating Craft Commerce to 4.6.0?
I recently updated Craft Commerce to version 4.6.0, but now whenever I run any Craft commands or navigate to site.com/admin, I encounter the following error:
You need to be on at least Craft Commerce ...
1
vote
1
answer
36
views
Save field value After Complete Order
I am using Craft Commerce and want to edit the order after it has been completed by the customer. For this I am using the EVENT_AFTER_COMPLETE_ORDER event.
Event::on(
Order::class,
...
1
vote
2
answers
23
views
Error when calling renderPdfForOrder() in Module
The error I'm receiving is:
Call to a member function getRenderLanguage() on null
My Code (Edit - simplified):
$mergeService = new Merger();
$batchFileName = 'VAT-' . $country . ( $date ? '-' . $...
0
votes
0
answers
35
views
Add to cart via Ajax (sometimes) results in abandoned carts and invalid CSRF
In Craft Commerce, I am using the Blitz Cache plugin. My "add to cart"-button uses ajax to add the product to the cart.
This is the twig-code for the form:
<form method="post" ...
0
votes
0
answers
47
views
PaymentMethods of type 'ideal' cannot be saved to customers
I working on a craft commerce project with subscriptions. I have problems with saving a paymentsource of the type "ideal" and "bancontact" with stripe. Creditcards and sepa ...
2
votes
1
answer
31
views
Create and display PopUps for Craft (+Commerce) Frontend
Is there already a solution or plugin that can be used to create/maintain popups in the control panel, which are then displayed to the user in the frontend? For example, I would like to create a pop-...
1
vote
1
answer
37
views
Displaying coupon error messages on front end commerce 4
I have read in the Commerce documentation that natively, commerce doesn't display any errors when a false coupon is being entered. Did I understand the docs correctly or is there any why to achieve ...
1
vote
2
answers
34
views
Stripe gateway only display creditcard for subscription plans
I'll working on a project where users can buy a subscription to recieve extra features in their account. In the Stripe dashboard I'll set up 2 different products year en monthly payment. In craft ...
0
votes
0
answers
54
views
Sprig add to cart display cart
products index.twig file include a Sprig component with filters:
{{ sprig('_components/productCategoryList.twig', { entryId: entry.id }) }}
productCategoryList.twig file includes a list of all ...
0
votes
0
answers
24
views
Stripe Commerce Plugin - Checkout Payment Form Type (capture address)
I am using this checkout option in my commerce site with the Stripe Commerce Plugin:
paymentFormType: 'checkout',
However it only captures the clients Postcode - is there an easy way to capture Billng ...
1
vote
2
answers
36
views
Webhook only firing when I log in
I've set up a Webhook in Craft 4 that triggers a Zap.
The Sender class is craft\commerce\elements\Subscription and the event name is afterSave.
When the trigger action happens (a user subscription), ...
1
vote
1
answer
87
views
Why are number fields actually text fields in Craft?
I am building a small price calculator in the Product type entry for Craft Commerce by building a custom plugin.
This plugin executes my javascript file.
The issue I am encountering is that I need to ...
0
votes
0
answers
26
views
Craft Commerce Stripe
I am using the commerce-stripe plugin and its all working ok. I was thinking about having a quick checkout option for products (so users dont have to go through basket and checkout etc).
Is there a ...
1
vote
1
answer
103
views
Payment form differences between Commerce 3 and Commerce 4 in headless application
I'm in the process of migrating Craft Commerce 3 to 4.
I handle the payments forms with VueJS, and I've been struggling to understand why my paymentMethod body params were ignored after the migration.
...
1
vote
1
answer
45
views
How to extend Craft Commerce?
We're building a webshop with Craft and Craft Commerce.
The products will have dynamic pricing based on the weight and material.
Is it possible to extend Craft Commerce products to add these fields ...
1
vote
2
answers
73
views
Valid Business Tax ID
Is there a way to check on an order if the Business Tax ID was valid? Craft validates this in the order process, but Im in need of being able to narrow down some logic to orders that have a valid ...
1
vote
2
answers
42
views
Return all orders from a list of countries in Commerce v3
A little stuck on trying to get the query right for this, I have a module where I need to write a function that returns all orders placed with billing addresses in a selected list of countries. The ...
0
votes
0
answers
31
views
Rounding Total Price Adjuster Commerce not working correctly
I have this adjuster which should round prices to the nearest 5 decimal.
I am pretty sure it had been working, and now it does not anymore.
I tried to debug, but I don't find the error.
In my commerce ...
0
votes
0
answers
17
views
Is Worldpay craft plugin integrates Cybersource
I'm kinda new to payment gateways,
Is the craft commerce-worldpay plugin
https://plugins.craftcms.com/commerce-worldpay
integrates Cybersource as stated in this worldpay docs
https://developer....
1
vote
1
answer
48
views
How do i check for customers, not users, in a cart
Using craft commerce 3.
I have an adjuster which applies a discount if a user of a certain usergroup.
I check this with:
$user = Craft::$app->getUser()->getIdentity();
if (($user && ($...
1
vote
1
answer
48
views
How to get category id of lineItem to use in commerce adjuster
I want to add an adjustment to a product in the basket via an adjuster,
only when the product has certain categories.
(10% off if there are more than 6 same items in the basket. It's not possible to ...
1
vote
2
answers
149
views
Stop customers from increasing line item
I have a site where the owners want to stop customers from ordering more than 1 type of item.
The Twig logic is already in place to stop any forms showing that would allow customers adding more than ...
1
vote
1
answer
72
views
How to make AJAX request to controller inside module?
Created a new module to receive form values and process API in Craft CMS 4. How to make an AJAX request to access a controller in my module?
module name - giftcard
controller - GiftCardController
...
1
vote
1
answer
32
views
Craft Commerce Missing Products Tab
I've just installed the craft commerce plugin to trial it, but I'm not seeing the products tab under Commerce in the backend? Am I missing something? I'm using Craft 4.5.10.
Thanks,
Chris
0
votes
0
answers
31
views
Craft Commerce: Sell digital products from pool of predefined license keys
We’ve been asked to build a shop to sell e-books. The e-books are published by a third party and we will receive a list of pre-defined license keys (thus stock can run out).
The plugin Digital ...
1
vote
2
answers
104
views
Update Craft Commerce cart with ajax
Have been trying to get cart updates via ajax.
I've looked at this answer:
'https://craftcms.stackexchange.com/questions/17347/update-commerce-cart-using-ajax'
My cart seem to update ok but I can't ...
1
vote
1
answer
108
views
I have an existing project called Craft cms v3.3, what should I do if I want to run it at local?(Mac OS)
I currently have a project that is definitely craft cms v3. I want to run it but this is the first time I keep stressing over it. Please help me
1
vote
1
answer
44
views
Why do I only have 3 options under 'Commerce' in Craft CMS Solo 4.5.6.1?
I have installed Craft Commerce 4.3.0 on Craft CMS Solo 4.5.6.1 on localhost (Xampp), but only have 3 options under 'Commerce' in the left-hand menu - Orders, Promotions, Store Settings.
Do I need to ...
1
vote
1
answer
76
views
Big upgrade completed locally, how to upgrade live?
I have a site that was Craft 3.4 and Commerce 3.x (unsure of exact version).
Locally, I've been spent a big chunk of today updating to the latest versions of everything and making sure all still works ...
0
votes
0
answers
97
views
Commerce 3: How to programmatically create a custom field and assign it to a Product
With this kind of setup:
function random()
{
return array_reduce(range(0, 9), fn ($x) => $x . range('a', 'z')[rand(0, 25)], '');
}
$salt = random();
$result = Craft::$app->getFields()->...
1
vote
1
answer
157
views
Is manual payment possible for Craft Commerce subscriptions?
I need to allow manual payments for Craft Commerce subscriptions. Typical users for this industry sector require an invoice and then make a bank transfer, and don't want to use credit card. It's low ...
1
vote
2
answers
94
views
Product URL missing category slug on production site
I upgraded a Craft CMS 3 site to version 4. The Product URI Format for my products look like this:
Before I re-save a product, the URL displays correctly the way it looked in Craft 3:
But when I re-...
1
vote
1
answer
131
views
Commerce LineItem Option validation
I have Line Item options that I'm trying to validate in a module. I'm using the example code from the docs here on the front-end of the cart.
Below that it says:
Commerce does not validate the ...
1
vote
1
answer
437
views
Craft Commerce 4 - customer phone number/address?
i am using Craft Commerce 4 and cannot get my head around how to add a phone number to a customers address at Checkout. I have a Commerce 3 site but the code does not work. I can see how to add a ...
1
vote
1
answer
107
views
Set default values for new Commerce products
I'm trying to set some defaults for newly created products. That is, when a new product is created, I want to set some settings to specific default values, but users should be allowed to change those.
...
0
votes
1
answer
21
views
reverse relation question in Commerce
I have a reviews section with an entry field to Commerce products. I'm trying to show the reverse relationship review on the product page. It appears to work when there are related entries but when ...
1
vote
1
answer
116
views
How to persist modified order of cart line items?
I wrote a function to sort / re-order the line items in a cart.
function sortCart(Order $order) {
$lineItems = $order->getLineItems();
$lineItemsOrdered = array();
// [...]
$order-...
0
votes
0
answers
124
views
How to modify a custom field on cart, when the cart is created
I want to set a custom field on shopping cart when I first retrieve it.
https://craftcms.com/docs/commerce/4.x/extend/events.html#modifycartinfo sounds appropriate so I tried doing this:
Event::on(
...
1
vote
1
answer
175
views
Delete All Products (and their variants)
I'm looking for the correct way to delete all of the products and related variants from my Commerce site. This is just for my local development environment as I'm debugging an import job. The delete() ...
1
vote
1
answer
87
views
How to represent member discount for Commerce products?
I'm working on a Craft Commerce project where users can register for paid events. The events have a different price for members and non-members of the organization the site belongs to. I'm not sure ...
1
vote
0
answers
47
views
Object of class craft\commerce\models\ShippingMethod could not be converted to int Error generating from craft commerce
At a little bit of a loss here, just updated a Craft 3 site and I've started getting an error thrown whenever the cart is accessed.
Relevant updates were:
CraftCMS 3.7.11 -> 3.7.27.2
Craft ...