customize shipping method magento - php

I am trying to change the view of shipping method in checkout page, this is what I have now:
I want to remove radio button and show free shipping if its free, otherwise I want to show flat rate, its decided by the total purchase amount.
But I am not able to find the page where I can change this. I found some files related to shipping:
/app/design/frontend/base/default/template/checkout/onepage/shipping.phtml
/app/design/frontend/base/default/template/checkout/onepage/shipping_method.phtml
but shipping method content is not coming from these files.

The available methods are rendered in /app/design/frontend/base/default/template/checkout/onepage/shipping_method/available.phtml
Look around line 34:
foreach ($_shippingRateGroups as $code => $_rates):
You can add your condition below that line to show free shipping or flat rate.
Edit:
Alternatively, you can override Mage_Checkout_Block_Onepage_Shipping_Method_Available::getShippingRates() method so that shipping method of your choice is displayed.

Related

WordPress WooCommerce can't checkout after I use php function to hide shipping options

My website is using WooCommerce (Version 6.0.1) without shipping extensions as all physical products will be picked up locally or shipped within only one region, but now I want to add an e-ticket product, no shipping required, using this event ticket plugin (Version 1.1.1; Pro Version Version 1.0.7).
I created a product category named Events for the tickets and hid all shipping options for this category using this method
I have found here, and although it's working perfectly in hiding the shipping options, when I checkout I can't proceed and instead will get the following message:
No shipping method has been selected. Please double check your address, or contact us if you need any help
I'm currently setting local pickup as the only shipping option for tickets by using the aforementioned code then setting the shipping id to display:none in Additional CSS, but that isn't really what I want, especially since it will also hide the shipping options for physical products.
I have read through lots of posts here but they either only hide some of the shipping options or they just suggest the use of extensions. It'd be great if I don't have to buy a WooCommerce extension to manage shipping per product. Is there's anyway to add/eddit another function in functions.php or WooCommerce plugin file to do that? Or some way to use that line of CSS conditionally? As far as I know, CCS doesn't have if statements, and I am not sure how I can do that in php. Any help on how to disable shipping for a particular product/category so that no shipping option needs to be be selected or on how to hide shipping method on Cart and Checkout page for a particular product/category should be much appreciated, thank you.

Programatically sending a Woocommerce shipping method to the bottom of the list on cart page

I am looking for a way to programmatically send a specific shipping method to the bottom of the list of methods displayed on my Woocommerce store's cart page.
The method in question is the Woocommerce local pickup method. It's currently defaulting to either the top of the list, or near it (depending on the particular methods offered for the products in the cart). The other shipping methods are being pulled from 3rd party plug-ins, so woocommerce is defaulting local pickup's precedence higher than those methods.
I thought about splicing the shipping $rates array at the occurrence of the pickup method and reordering that way, but I am not sure if that's the most efficient way of doing it. I am very new to Woocommerce and PHP.
Ideally I just want the "local pickup" method to always be at the bottom of the list.

Is it possible to hide the shipping method step on magento checkout process

Is it possible to hide the shipping method step on the magento checkout process. I want to remove the shipping method step only on checkout page, not permanently.
What i am trying to achieve is on the cart page when the customer enters his postcode for shipping estimate and then update total. I will want to use his choice he made here for his order. So I see no relevance for him to alter his shipping choice afterwards as I only have one shipping option.
I have searched around and found there are ways of removing the step altogether and enabling a default shipping method. However I am using a table matrix so the shipping charge differs based on postcode entered, so i can not set it as a default.
Please can you advice if it is possible to achieve what I want and if so how would I approach it.
Advice and guidance is appreciated.
Thanks

How to show Delivery methods (Shipping Method) in Magento product page

I have a magneto Store and I have a custom requirement.
I have my own templet and I need to display Delivery Methods on product page.
Normally shipping methods available on a Checkout page. But I need to add it on Product page.
Please help me or guide me to do this.
Many thanks
Umanda
afaik are the shipping methods are connected to the address. No address - no shipping methods.
but if you look into Mage_Checkout_Block_Onepage_Shipping_Method_Available you could read all the data from
Mage::getStoreConfig('carriers/*/title');
so just call
Mage::getStoreConfig('carriers');
loop over all carriers, collect the titles and check wether they are activated or not.
And have a look into
app/code/core/Mage/Checkout/Block/Onepage/Shipping/Method/Available.php:40
Mage_Checkout_Block_Onepage_Shipping_Method_Available::getShippingRates()

Retrieve shipping price via webservice in Magento

I have created my own shipping module, but problem is that collectRates function is called when user comes to shipping method step and then these prices are just shown to user. But in my case I have to use webservice to get price, and there are some options user can choose in shipping method step screen, which will affect shipping price. Price itself is calculated on other server.
So how I can set shipping price via ajax in shipping method step?
I found working solution myself. I call shipping.save() JavaScript function to update shipping methods page, then collectRates (php) function in my own shipping module is called and everything works correctly.
shipping.save();

Categories