Answer the question
In order to leave comments, you need to log in
How to make different shipping cost in woocommerce?
Can you please tell me how you can prescribe each city its own shipping cost?
For Ukrainian cities.
In some cities, delivery is free, and in some it is paid, and each city has its own cost.
And how to make it so that the client entering the store could immediately select the city?
For example, to have a pop-up window asking what city are you in? Or did it determine the city itself, for example, "Your city is Kyiv?"
Answer the question
In order to leave comments, you need to log in
If I were you, I would create a plugin to calculate shipping costs. Dig in the direction of creating a child class for the WC_Shipping_Method class and overriding its calculate_shipping method according to your shipping cost calculation logic.
Code example:
class YouShippingClass extends \WC_Shipping_Method
{
final public function calculate_shipping($package = array())
{
//проверка того, что сумма больше 6500 руб - доставка нулевая
global $woocommerce;
$cart_products = $woocommerce->cart->get_cart();
if($woocommerce->cart->cart_contents_total + $woocommerce->cart->tax_total > 6500)
{
$this->addRate($this->get_rate_id(), 'Доставка EMS', 0);
}
return false;
}
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question