Woocommerce Shipping Calculation Logic - wordpress

The plot:
I am working with a Dropshipping company that has an API for providing products, the shipping is calculated this way:
Every product comes with a shipping size ( S,M,L ... ) and for each country this sizes have different fixed prices. I am saving this shipping size in a custom meta.
Example:
France
Size M: 10$
Size L: 15$
Spain
Size M: 15$
Size L: 20$
The problem:
I cannot seem to figure out a way of implementing this into woocommerce. I see that I can setup a flat rate for each country but I cannot implement these different sizes.
If this is not possible with plain Woocommerce, I want to implement something myself with php or I am also open to any official/verified Add-ons.

I figured out this on my own - so apparently I can make a shipping class for each of those sizes ( S, M, L ) and then I can setup Flat Rates by country and shipping class. This was very easy after all, no custom code required.

insert by location rules with multiple locations you can place fees for each location. A different rate can be configured in woocommerce and can also be configured by postal code

You can also use the plugin for handling all this stuff. I figured out this plugin maybe it can help you out. Advanced Flat Rate Shipping Method WooCommerce.
In this plugin you can create your own rules.

Related

Client needs to specify origin zipcode per item to calculate shipping costs

Basically the title. The client has multiple distribution locations with specific items coming from specific warehouses. They want to calculate shipping based on where the items are coming from specifically. I see the "Per Product Shipping" module but I am not sure that it does quite this. Im hoping to not have to write a custom plugin for this. Does anyone know how to do this out of the box, a module that already does it, or can cofirm thet Per Product Shipping does this already?
Thanks

WooCommerce Shipping: conditionally hide shipping method based on shipping radius/distance

I'm trying to hide shipping method based on shipping distance or based on radius around shipping origin.
I've tried using the plugin WooCommerce Distance Rate Shipping, but it cannot achieve this since it's adding a shipping method to the shipping zone...
I'm trying to have these conditions:
If shipping distance is 50 km and lower, then hide shipping method A
If shipping distance is 51 km and higher, then hide shipping method B
Could someone point me in the right direction?
Thanks!
1st you need algorithm to calculate distance between user entered address and your shop store.
Search for APIs which can help you in that, most of them use coordinate to addresses to do that. google API is also available. Go through these, it might help -
https://developers.google.com/maps/documentation/javascript/geometry/
https://developers.google.com/maps/documentation/javascript/reference#spherical
If you are supporting multi-vendor AKA multiple(total dynamic) warehouses then this will become necessary.
But if your store address is fixed one, easiest way is make a zone of addresses which falls under such radius and use existing zone system.
You can achieve it without plugins by defining shipping zones and limit each zone by zip codes. You need to manually calculate each zones radius though.
Example:
Step 1: Country Sweden, Zone: Solna, Zip code range: 16900...17331
(WooCommerce understand 3 dots ... as any zip codes from 16900 to 17331
in this case the distance is less than 50 km so I would define shipping rate A for this area.)
Step 2: go to calcmaps.com/map-radius/ and draw a circle around areas you want to add so you can define zip code ranges based on distance
Step 3: define shipping alternatives like Flat rate etc. for each area.
When customer enter a zip code Woocommerce provide available shipping method based on that zip code.
it's one way and requires some works but achievable.

How to calculate product price in woocommerce using formula

I am developing en ecommerce site for a jewellery. They need to calculate product price automatically using a formula. The following is the format of the required formula.
(quantity * gold rate) + making charge + stone rate(if available)
Here gold rate may vary frequently and stone rate is not mandatory.
This will also need to apply for other type of products(silver, diamond etc).
eg for silver the formula will become
(quantity * silver rate) + making charge + stone rate(if available)
Only the final price is need to display in site.
Also I need to set gold rate and silver rate globally, because this will be same for all gold and silver ornaments.
I found some plugins, but not found one with all these requirements.
Can someone please suggest any solution
I'm assuming you have some coding knowledge...
As you're using woocom I would go toward creating a new custom category/taxonomy called "raw material".
From there I would add all the required terms, here for instance gold, silver, diamond...etc. I would then add a custom meta field to each terms called "rate" (*).
Upon creating a new product, you would select what raw materials the item is made of, which would enable you to fetch the custom meta we created called "rate".
Then we could use a bit of JS magic to do the required calculations, and that's it. Not really hard to put in place.
But like #disinfor said, at SOF we don't code, we help and fix problems. If you want to hire someone you can try Fiverr.
(*) Adding custom meta to terms: https://developer.wordpress.org/reference/functions/add_term_meta/

Woocommerce 2 items in the cart = price x

I would like to add conditional pricing to the woocommerce cart.
I have business card products priced at 65.00 for 250 and 85 for 500. I would like it so when a user adds two product items in the cart at the individual price of 65.00 the cart total is not 130 but rather a value I specify.
I know some of the woothemes plugins could do this but I don't want to pay as I know somewhere out there is a simple enough solution.
Any help much appreciated.
Thanks
You can just create a woocommerce coupon in Wordpress that will discount the desired products(s)/cart total by a specific percentage amount.
You can set various "Usage Restriction" settings that will make the coupon only be applicable under certain circumstances (such as minimum spend, products, expiration date). Users can then be provided with a a coupon code to enter at the cart checkout.
This will be the easiest and fastest the solution that doesn't involve creating code for Dynamic Pricing.
The following link will help you to set up a Coupon:
WooCommerce 101 Coupons
For more specific pricing needs you will have to create a function that hooks into the Woocommerce shopping cart in the functions.php file. The logic for the function should be something like this:
Get the cart contents.
Check that the number of items in the cart are equal to 2 (or more if you want).
if $cart_count == 2 then $cart_total - $x_amount.
This Question will help you understand how to write a simple function to achieve this.
Best of luck! :)

Adding fees for paypal and credit card depends on customer geo zone

I have found this - WooCommerce: Add fees to card based on payment gateway selected nice plugin, but I would need a plugin that I can set up three different fees to customers from different geo zones..
For example. - Slovenia - 4.8% - Serbia - 4.9% ect..
How can I do that? With which plugin?
Or is it possible to modify upper plugin to add geo zones for each fee? I am not good at coding, so I do appreciate some help.
#Marin Atanasov - I can't, because this is not tax, it's fee and it's not acceptable for our inspection. I already had that tax created in paypal, but it's not ok, because I have three different webstores, one in OC, one in woocommerce, and one in shopmania. I found one extension for OC that already calculates my fee for slovenian users, so I removed tax (so called fee) for them in paypal, but than the webshop in shopmania targets costumers in ex yugoslavia. But, the OC shop also does not exclude ex yugoslavian costumers, so the fee can be charged twice. The problem is also with the third webshop - woocommerce- where I have now for all costumers set up 3.4% fee, but if the costumer from ex yugoslavia orders than the fee is again charged twice, because I didn't remove it from tax in paypal. I need to find a resolution so the all three webshops have their own extension to calculate the fee, and delete taxes that I already set up in paypal.
If paypal would allow multiple webstores under 1 company name, this would be easy to fix.. but I can not enter my credit card number for all three webstores.. :(
Do you have any idea what to do? I am lost.
Perhaps you can use the built-in taxes? They provide you with the option to specify custom tax rates for countries.
To do this, you would have to:
Create your custom tax rates for the preferred tax class under WooCommerce -> Settings -> Tax
Select your preferred tax class for each of the products, and make each product Taxable
Make sure the taxes are enabled and properly configured per your preferences in WooCommerce -> Settings -> Tax
You can also use one plugin to add commission to certain payment gateways with different percentages
Payment Gateway Based Fees and Discounts for WooCommerce

Resources