Post by wesse249 » Mon Jan 25, 2021 4:27 am

Hello,

I’m looking for a solutions for hiding all shipping methods when a customer has free shipping instead of pickup. I found Some extensions but they hide also the pickup solution. I have the latetst version of oc.

Can somebody help me?

Thanks, Jan
Last edited by wesse249 on Wed Jan 27, 2021 4:26 am, edited 3 times in total.

Newbie

Posts

Joined
Fri Oct 15, 2010 3:13 am

Post by Johnathan » Mon Jan 25, 2021 10:52 pm

I have a tutorial on how to do this here:

https://www.opencartx.com/tutorials#sho ... e-shipping

Image Image Image Image Image


User avatar
Administrator

Posts

Joined
Fri Dec 18, 2009 3:08 am


Post by wesse249 » Wed Jan 27, 2021 4:11 am

Hello Johnathan,

Thanks for tour reply and solution. Is it also possible to show store pickup and free shipping?

Newbie

Posts

Joined
Fri Oct 15, 2010 3:13 am

Post by Johnathan » Wed Jan 27, 2021 4:46 am

That's a bit more complicated, you may want to get something like Restrict Shipping Methods which can actually do this for any shipping method, and doesn't require modifying code. However, if you want to try it yourself, you could change the edit suggested in my tutorial to this, which I haven't tested but should work:

Code: Select all

$new_shipping_quotes = array();
if (isset($quote_data['free'])) {
    $new_shipping_quotes['free'] = $quote_data['free'];
}
if (isset($quote_data['pickup'])) {
    $new_shipping_quotes['pickup'] = $quote_data['pickup'];
}
if (!empty($new_shipping_quotes)) {
    $quote_data = $new_shipping_quotes;
}

$new_shipping_methods = array();
if (isset($method_data['free'])) {
    $new_shipping_methods['free'] = $method_data['free'];
}
if (isset($method_data['pickup'])) {
    $new_shipping_methods['pickup'] = $method_data['pickup'];
}
if (!empty($new_shipping_methods)) {
    $method_data = $new_shipping_methods;
}

Image Image Image Image Image


User avatar
Administrator

Posts

Joined
Fri Dec 18, 2009 3:08 am


Post by xxvirusxx » Wed Jan 27, 2021 8:13 am

So you want to hide other shipping method (except Pickup), when free is available?

Attachments


Upgrade Service | OC 2.3.0.2 PHP 8 | My Custom OC 3.0.3.8 | Buy me a beer


User avatar
Expert Member

Posts

Joined
Tue Jul 17, 2012 10:35 pm
Location - România

Post by wesse249 » Wed Feb 03, 2021 2:05 am

Thank you very much!

Newbie

Posts

Joined
Fri Oct 15, 2010 3:13 am
Who is online

Users browsing this forum: davidmarkdavid34 and 270 guests