6

I agree with the basic underlying premise that showing full cost - i.e. with shipping - is essential on the cart index page for a modern checkout. Customers loathe what they see as a hidden surprise if they hit shipping costs later in the process and your completion rate plummets in my experience. Luke's answer is right about the root cause of the issue - ...


4

Add a custom plain text field to your orders, say test. Then, when calling updateCart, you can add data in to this custom field using a form with an input named like this: <input name="fields[test]" type="text"> etc... This data will then get saved with the order. This same approach can basically be applied to any field/type. To actually ...


4

You're right that the shipping calculator API doesn't lend itself to different rates per lineItem as such, but I'm pretty sure you can still make it do what you want. (But longer term I agree that getLineItemRate(lineItem) or similar should be an option!). Basically, for now, you can do anything you like in the getBaseRate() and return the total from that ...


3

Ok, so shipping is not a necessity for a Commerce site (e.g. think about e.g. digital downloads - shipping is not relevant here) - so Commerce does not force you to set a shipping method on an order. It's up to you to work out how and where you need to do this, if you do. A lot (most,even) of it is often best tackled at the front end via your flow and ...


3

The short answer is no, it is not possible. The much longer answer I will add to your other question: Setting Shipping Country and Method for the Cart screen


2

I think you're looking for the attribute function: {% set field = attribute(addressFields, key) %} {{ field.label }}


2

Product:<br> Shipping Category: {{ product.shippingCategory.name ?? 'None' }}<br> Tax Category: {{ product.taxCategory.name ?? 'None'}}<br> Variant:<br> Shipping Category: {{ variant.product.shippingCategory.name ?? 'None' }}<br> Tax Category: {{ variant.product.taxCategory.name ?? 'None' }}<br>


2

Yes this is definitely possible. We don't use any of Commerce's in-built shipping stuff - fields or calculation, as it's too limited for our needs (not Commerce's fault - we have very complicated shipping requirements!). You will want to write yourself a custom module with either a full custom shipping calculator, or an adjuster for shipping. You'd use an ...


2

I've not tried this so early in the checkout process, but how about adding the following to your Add To Cart forms? Replace the # with the correct value obviously. <input type="hidden" name="shippingAddress[countryId]" value="#"> <input type="hidden" name="shippingMethod" value="#"> That way, as soon as people arrive on the Cart page a country ...


1

Were I doing this, I would create a single (or an entry, or a global I guess) with a table (or maybe Matrix) field that would hold the shipping price chart. I'd then create a custom shipping plugin in Commerce, that references this data and returns the shipping cost. This would give a very nice UI for editing the products shipping, and would be a simple ...


1

I ended up using a custom adjuster anyways. I found out that registering custom adjusters hasn't been deprecated, but using custom types has. https://craftcms.com/docs/commerce/3.x/adjusters.html


1

products that don't require shipping costs are (obviously) included in the order total which means the shipping costs are higher than they should be. It sounds like you're only using one shipping class? Commerce can provide multiple ways to ship (methods) but also how to handle different categories of products (shipping categories). What I'd do is create 2 ...


1

For anyone else viewing this question - until there is a zero value adjuster as mentioned by Luke, my solution has been to simply do the discount checks in my custom module. A little messy but it'll do the job for now.


1

I took a guess and the answer was {{product.shippingCategory}}


1

Does your shipping method have any conditions set? Like a country or region? I think getAvailableShippingMethods() takes into account your shipping address (if any) and only shows shipping methods that apply to the current shipping details. Second thing to check: does your shipping method have at least one shipping rule? Commerce needs a shipping rule to be ...


1

Finally found a solution by adding a template variable to my custom module. I can now test from both front-end and back-end if the order really need shipping* with a single if statement. I split my product types in two segment; physical and virtual, so I can easily loop through my order lineItems to look at the product typeId.


1

There is nothing stopping you selling products that are not physical. Just mark the product as free shipping, and skip the address and shipping method selection screens entirely (the front-end is totally up to you). p.s Product Type settings even have a 'has dimensions' checkbox you can turn off. p.p.s check out https://github.com/craftcms/digital-products


1

Probably depends on exactly what you're looking to do, but it does look like DPD has some APIs you can integrate with: https://www.dpd.com/nl_en/business_customers/help_en_tools/labelprint_tools/dpd_integration_services Assuming that's the case, you'd be able to write a Craft/Commerce plugin to pull the data out that you need and interface with their APIs.


1

The current rule for the total in Commerce 1 is in craft/plugins/commerce/models/Commerce_ShippingRuleModel.php starting at line 214: if ($this->minTotal && $this->minTotal > $order->itemTotal) { return false; } if ($this->maxTotal && $this->maxTotal <= $order->itemTotal) { return false; } Try changing it to ...


1

You would need to either 1) Delete all the countries you don't use within your site in commerce > settings > countries. 2) Simply hide them in twig with something like this: {% set allowedCountryIds = [1,3,4,6,7] %} {% for key, country in craft.commerce.countriesList %} {% if key in allowedCountryIds %} <option value="{{ key }}">{{ ...


1

Within Commerce Settings -> Shipping Methods you can set within the rules of that method, the 'Minimum Order Total Price' and the 'Maximum Order Total Price' and an associated shipping cost, so yes, it is possible to recreate your clients existing setup.


1

The free shipping flag on individual products stops costs being calculated by any shipping rule that is a per item rate or weight rate. See https://craftcommerce.com/docs/product-model#freeshipping


1

Turns out it was another plugin interfering with the order total.


1

It looks like you may be using an out of date version of the plugin. Can you try updating to the latest and see if you're still getting this error? https://github.com/onedesign/oneshipstation/archive/master.zip


1

Confirmed by Luke this was due to a bug to be fixed in the next release of Commerce.


1

Well, I think somewhere in-between Brad's answer and this is the solution... I too have a mix of tangible and tangible products on my site. In the CP I have checked the "Free Shipping" checkbox for all non-tangible products when I create them. Because I eventually will have products that require shipping, I didn't want to completely do away with the ...


1

Commerce_OrderModel has a getShippingMethod() that will return a Commerce_ShippingMethodModel class of the current shipping method, or null if nothing has been set. If you've already got the order in the template is should be as simple as: {% if order.getShippingMethod() %} Shipping. {% else %} No shipping. {% endif %}


1

100% untested, but I think one way to go would be to use addError on one of the Commerce_OrderModel's attributes (in the defineAttributes method). Then your template could do something like: {% if 'myShippingMethod' not in craft.commerce.availableShippingMethods|keys %} {% for error in order.getErrors('theAttribute') %} {{ error }}<br /> ...


1

I've also been struggling with this a lot. I get why you have to have an address defined in order to process the shipping rules, but the lack of defaults is maddening. My client's checkout process is very lean - ideally one page. There are no user accounts, no shipping method choice (it's enforced by cart contents and address) and no payment method choice. ...


1

A shipping address needs a First Name (firstName) and Last Name (lastName) as they are required fields - This is why your cart won't update. You will also run into issues if you write any address validation for use during the checkout process. For these reasons it isn't advisable to set fields on an order's address for a customer. It is perhaps a better ...


Only top voted, non community-wiki answers of a minimum length are eligible