Closed i95devdivya closed 7 years ago
I resolved this issue by using checkout_cart_update_items_after, checkout_cart_save_after events. In that observer i wrote the following code inside execute() method. public function execute(\Magento\Framework\Event\Observer $observer) { $cart = $observer->getData('cart'); $quote = $cart->getData('quote'); $quote->getShippingAddress()->setFreeShipping(false); $quote->save(); }
Now it's working fine for me.
Thank you @i95devdivya
2.1.5 and this is still needed in order to disqualify an order from free shipping when it previously qualified for free shipping and should not any longer.
I can confirm this Issue on 2.1.6.
@i95devdivya this workaround is fixing the issue temporary. Thank you.
Edit: You have missed handling the event sales_quote_remove_item since the issue remains when the "Remove Item" Link in cart was used.
For me free shipping is not working properly either in 2.1.6.
My rules are only free shipping for some region, with any discount on product. But it display in every situation.
It has a strange behavior. It was displaying all the time outside rules. It worked once and now it does not display. I'm not sure how to fix it. I read the fix, but I'm now really sure where to place the code. I don't have a module for it, because I see execute() method in many files. What exactly should I do to fix the issue?
Hi @i95devdivya. Thanks for reporting this issue. Internal ticket MAGETWO-70420 was created.
I have a workaround for free shipping rule that works but there is a minor bug to adjust. Usually when we want to use free shipping we enable the method in backend. I set that disabled. I went to create a Cart rule for one region, 100% discount on product, matching products price is 0. Free shipping happens to appear following the specif rules. But when the user switch the zipcode, cart does not update rules, only when page is reloaded. But it is working better than when free shipping is enabled.
Actually, the workaround solved my problem after setting priorities in cart rule.
Looks to be the same issue reported last year #6040
I can confirm this Issue in shopping cart price rule for free shipping not working properly 2.1.8
@i95devdivya, thank you for your report. We were not able to reproduce this issue by following the steps you provided. If you'd like to update it, please reopen the issue. We tested the issue on 2.3.0-dev, 2.2.0, 2.1.9
I have added cart rule for particular category https://aafiyat.in/all-islamic-books/all-deeniyat-books to free shipping now when i add non freeshipping product first and then free shipping product I don't see free shipping option which is perfect but when I add first freeshipping product and then non freeshipping product then both product goes for free shipping which is strange. please help
I can confirm, what @srtrend describes, occurs also in 2.2.3. I have free shipping cart rule "for matching items only", but I will get free shipping for whole order if the first item has free shipping rule applied. Problem is in OfflineShipping module at Model/Quote/Address/FreeShipping.php file at method isFreeShipping. Loop has logical problem here:
$addressFreeShipping = true;
$shippingAddress->setFreeShipping(0);
foreach ($items as $item) {
...
$addressFreeShipping = $addressFreeShipping && $itemFreeShipping;
if ($addressFreeShipping && !$item->getAddress()->getFreeShipping()) {
$item->getAddress()->setFreeShipping(true);
}
}
If the first items sets the free shipping, then it will never get cleared.
@pemann Do you have any solution to it.
@srtrend no I don't have. The code where the free shipping is calculated is so... "unique"... that I cannot wrap my head around it :(
The following change worked for me:
foreach ($items as $item) {
...
$addressFreeShipping = $addressFreeShipping && $itemFreeShipping;
//if ($addressFreeShipping && !$item->getAddress()->getFreeShipping()) {
// $item->getAddress()->setFreeShipping(true);
// }
$shippingAddress->setFreeShipping($addressFreeShipping && $itemFreeShipping);
}
Why was this closed? Is this fixed or forgotten? @magento-engcom-team
This is still not working in 2.2.5! Why is this closed?! I create a simple attribute "Free Shipping" with dropdown of 'Yes'. Create Cart Price Rule, set condition based on Free Shipping Attribute, Action Free Shipping for Matching Item Only, no free shipping. I've enabled and disabled 'Free Shipping' in Shipping Methods, I've let the system try the Free Shipping method from Fed-Ex. Nothing seems to work. This shouldn't have been closed.
I am experiencing a similiar issue as nickpiro. I am using FedEx as my shipping merchant. I would like to only offer free shipping to the continental United States. I have enabled free shipping from Stores > Configuration >> Shipping Methods and created the Cart Rule
If ALL of these conditions are TRUE Shipping Country is United States Shipping State/Province is not Alaska Shipping State/Province is not Hawaii
but it didn't work. It offers free shipping to all of the United Sates when it should only allow the continental United States. I then took a further step and added conditions for postal codes.
If ANY of these conditions are TRUE : Shipping Postcode greater than 00900 Shipping Postcode less than 96200 If ALL of these conditions are TRUE : Shipping Postcode equals or greater than 97000 Shipping Postcode less than 99500
Action Apply to Shipping Amount: Toggled to Yes Free Shipping: For shipment with matching items
Can someone please let me know how we can resolve this. This preventing us from going live.
I was also facing this issue I fixed it using the following steps:
1- Move vendor/magento/module-tax/view/frontend/web/js/view/checkout/summary/shipping.js
to your custom theme e.g. app/design/frontend/Vendor/Theme/Magento_Tax/web/js/view/checkout/summary/shipping.js
.
2- Replace price = this.totals()['shipping_amount'];
to price = quote.shippingMethod()['amount'];
3- Replace price = this.totals()['shipping_incl_tax'];
to price = quote.shippingMethod()['price_incl_tax'];
Hope this solution would help you. :)
I wonder if this is part of the problem:
Next Exception: Report ID: webapi-5c379916d49a1; Message: Property "TriggerReload" does not have corresponding setter in class "Magento\Quote\Api\Data\AddressInterface"
I get this exception on checkout page when selecting the different shipping options AFTER one has been previously selected. Any further changes in shipping selections will not update the cart shipping price.
CE 2.1.16
It is still not working. Can anybody tell what is the solution?
I was also facing this issue I fixed it using the following steps:
1- Move
vendor/magento/module-tax/view/frontend/web/js/view/checkout/summary/shipping.js
to your custom theme e.g.app/design/frontend/Vendor/Theme/Magento_Tax/web/js/view/checkout/summary/shipping.js
.2- Replace
price = this.totals()['shipping_amount'];
toprice = quote.shippingMethod()['amount'];
3- Replace
price = this.totals()['shipping_incl_tax'];
toprice = quote.shippingMethod()['price_incl_tax'];
Hope this solution would help you. :)
Is it working for you? I replaced that code in the vendor files but not working.
Kindly reopen this issue.
Yeah, this should be reopened.
is there a solution?
I had the same problem and none of the above worked for me. The Free Shipping Rules we had set up were for if the Shipping Method was set to the default shipping method, and the was order above a certain amount according to the destination country.
There were 2 issues
It took a certain combination of steps for a customer to get free shipping, but it was possible.
The first issue was because the Shipping Method was not initially set when the rules were applied and therefore was not giving free shipping when it should have. The second issue was the the free shipping flag was not reset when the country was changed or the quantity updated.
Both were resolved with the same plugin, as follows
etc/di.xml
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:ObjectManager/etc/config.xsd">
<type name="Magento\Quote\Model\Quote\TotalsCollector">
<plugin name="model_totals_collector_plugin" type="Vendor\Name\Plugin\Model\TotalsCollectorPlugin" sortOrder="1" disabled="false"/>
</type>
</config>
and plugin code (uses Amasty Checkout config)
namespace Vendor\Name\Plugin\Model;
class TotalsCollectorPlugin
{
/**
* @param Amasty\Checkout\Model\Config
*/
private $checkoutConfig;
public function __construct(
\Amasty\Checkout\Model\Config $checkoutConfig
)
{
$this->checkoutConfig = $checkoutConfig;
}
public function beforeCollectAddressTotals(
\Magento\Quote\Model\Quote\TotalsCollector $subject,
\Magento\Quote\Model\Quote $quote,
\Magento\Quote\Model\Quote\Address $address
) {
if (!$address->getShippingMethod()) {
$address->setShippingMethod($this->checkoutConfig->getDefaultShippingMethod());
}
$address->setFreeShipping("0");
return [$quote, $address];
}
}
Hope that helps someone
Preconditions
Steps to reproduce
Expected result
Actual result