I have setup the free shipping for specific product categories in magento by refering this blog post http://www.regularjen.com/archives/2010/06/11/free-shipping-on-a-single-item-in-magento/ . And its working fine. Now the issue is , Magento showing both free shipping & other shipping charges in shiiping reuslt.
How can i remove the those result ?
One solution might be to override the getShippingRates() method which you can find in the Mage_Checkout_Block_Onepage_Shipping_Method_Available class.
public function getShippingRates()
{
parent::getShippingRates();
if (isset($this->_rates['freeshipping'])) {
$this->_rates = array('freeshipping' => $this->_rates['freeshipping']);
}
return $this->_rates;
}
Related
I am trying to create a functionality when a user tries to select COD as a payment option then set shipping to Free Shipping (Make this shipping option available).
Right now I have added this code.
add_action( 'woocommerce_checkout_update_order_review', __NAMESPACE__.'\\refresh_shipping_methods', 10, 1 );
function refresh_shipping_methods($post_data)
{
if (isset($post_data['payment_method']) && $post_data['payment_method'] === 'cod') {
// I am not sure how to add Free Shipping Method here.
}
}
I am unable to figure out how can I add free shipping method here when it isn't available in the available_shipping_method.
How can I add it programmatically ?
I have my own shipping method with some logic.
//some logic
$method->setPrice($price);
When in admin panel in promo rules i set free shipping for some condition, all other shipping method set to 0, but not may.
Help me please, what am i missing?
use
if ($request->getFreeShipping() === TRUE) {}
I've installed a plugin that enables a custom shipping method into my store (calculates shipping method with my postal service).
It works with any product, except those with recurring profile enabled.
I found this link http://www.magentocommerce.com/knowledge-base/entry/working-with-recurring-profiles/Magento-Knowledge-Base-Working-with-Recurring-Profiles saying:
... For products with recurring profiles, the customer can only choose
between the fixed-price shipping methods (flat, table or free) when
checking out. ...
Why there is this rule? How can I make my custom shipping method work with recurring profile products?
I've tried these plugins and both doesn't work.
https://github.com/pedro-teixeira/correios
https://github.com/willstorm/correios
Which files should I look at to edit to solve this?
To solve this you need to basically change your shipping method class in order to add this:
class Namespace_Shipping_Model_Carrier_Customrate
extends Mage_Shipping_Model_Carrier_Abstract
implements Mage_Shipping_Model_Carrier_Interface
{
protected $_code = 'my_customrate';
protected $_isFixed = true; // << THIS ONE
...
}
I've been cracking on this for 6 hours now.
I would like to remove the shipping form that removes the shipping estimates and have a flat fee in the totals.
I already tried this http://www.danneh.org/2010/08/adding-shipping-costs-to-the-cart-automatically-in-magento/
but no use, can someone confirm if this works or maybe give a better idea?
Thank you!
Just Follow this step to set shipping methods
In your saveBillingAction() and saveShippingAction() in this condition
if (!isset($result['error']))
call $this->saveShippingMethodAction(); function and
Put this code.
public function saveShippingMethodAction()
{
$this->_expireAjax();
if ($this->getRequest()->isPost()) {
$data = $this->getRequest()->getPost('shipping_method', 'flatrate_flatrate');
$result = $this->getOnepage()->saveShippingMethod($data);
$this->getResponse()->setBody(Zend_Json::encode($result));
}
}
In your save shipping methods steps.
Hope this will work for you.
I'm currently working on a Magento backend plugin to create widgets for products. I'm trying to get a list of Shipping costs for a product for every country.
What I've got:
I've got a backend controller that loads a product model and I get all the data I need from this model.
The problem is getting a list of shipping costs for each country that is defined. How can I do that?
I've tried to use the example (http://www.magentocommerce.com/magento-connect/EcomDev/extension/3860/ecomdev_productpageshipping) posted by ʍǝɥʇɐɯ in the comments. But this is not working, I always get an empty array.
$addToCartInfo = array("estimate"=> array("country_id"=> "US"), "product"=> "1", "related_product" => "", "qty" => "1" );
$product->setAddToCartInfo($addToCartInfo);
$quote = Mage::getModel('sales/quote');
$shippingAddress = $quote->getShippingAddress();
$shippingAddress->setCountryId('US');
$shippingAddress->setCollectShippingRates(true);
$request = new Varien_Object($addToCartInfo);
$request->setQty(1);
$quote->addProduct($product, $request);
$quote->collectTotals();
$rateResult = $shippingAddress->getGroupedAllShippingRates();
Is there any difference between frontend and backend in this example that makes this code unusuable? How can I do that in the backend?
There is a module somewhere on Magento extensions that does that - maybe have a look for it first and re-use their code.