V4.1 Negate Additional Shipping Charges when Local Pickup

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.
4 years ago
Hi Andrei,

This was a reported bug in V4.0

After a recent upgrade to V4.10, I still find that if an additional charge is added to a product and the customer selects local pickup the charge is not removed from the cart.

This can be tracked by the previous topics and work item below.

https://www.nopcommerce.com/boards/t/51517/v40-negate-additional-shipping-charges-when-local-pickup.aspx

https://github.com/nopSolutions/nopCommerce/issues/2959

Thanks, Greg
4 years ago
Hi Greg,

Thanks! We'll check it one more time. I've just reopen the issue
3 years ago
Done. Please see this commit for more details.
3 years ago
@Dmitriy

Something does not look right...

if (_shippingSettings.AllowPickUpInStore && !_shippingSettings.IgnoreAdditionalShippingChargeForPickUpInStore && pickupPoint != null)
{
    adjustedRate += GetShoppingCartAdditionalShippingCharge(cart);
}  


The ... && pickupPoint != null  
would mean that the if-clause is only executed when there is a selected pickup point (and of course, ... not Ignore...).  But, the rate also needs to be adjusted when there is no pickup point at all (pickupPoint == null).  Also, I don't see the point of looking if any pickup point was selected by customer.  If either there is NOT AllowPickUpInStore, or there is AllowPickUpInStore and NOT IgnoreAdditionalShippingChargeForPickUpInStore, then the Additional Shipping Charges should be added.   I.e. it probably needs to read as:

if (!_shippingSettings.AllowPickUpInStore || !_shippingSettings.IgnoreAdditionalShippingChargeForPickUpInStore )
{
    adjustedRate += GetShoppingCartAdditionalShippingCharge(cart);
}  



(P.S.  Is it a bit odd that the GitHub commit view/page is showing that code change section with header
public virtual bool IsFreeShipping
when the change was made in method
public virtual decimal AdjustShippingRate
?
3 years ago
Thank you for paying attention to this!

In fact, the condition should include the option when we do not have pickup points. In this case, for any setting of IgnoreAdditionalShippingChargeForPickUpInStore, an additional fee must be charged.

You can see the working solution here.
3 years ago
DmitriyKulagin wrote:
...the condition should include the option when we do not have pickup points. ...


I don't know if you mean having any pickup points configured or that the customer has selected one during checkout, which is what you are testing:
var pickupPoint = _genericAttributeService.GetAttribute<PickupPoint>(cart.FirstOrDefault(item => item.Customer != null)?.Customer,
                    NopCustomerDefaults.SelectedPickupPointAttribute, _storeContext.CurrentStore.Id);


I still don't think it matters in either case.  I.e.  there is no reason to lookup pickup points;  the settings alone should determine whether to include the additional charges.
3 years ago
Sorry, you're right..
If AllowPickupInStore, but customer is not doing pickup in store, then it should add extra charge.
3 years ago
Hey Guys,

To the NopTeam, Dmitriy Kulagin, NopTools

Would like to extend a great job and thank you to all for getting this fixed.
I have implemented the changes on my live site and all seems good.

Greg
This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.