admin管理员组文章数量:1421000
Use Case: Multiple Shipping Methods per Order
Context
We have a WooCommerce online store with 2 products:
Framing Product. Price: 50 USD.
Print Product. Price: 20 USD.
Plugins installed:
FedEx WooCommerce Shipping with Print Label
...
Shipping Rates:
For Framing Products we need to apply a Flat Shipping Rate [ 15 USD ] since we deliver these products personally.
For Print Products we need to use Fedex delivery service.
Goal
We need to allow our customers to have in the same order both kind of products: { Framing Products, Print Products }.
Cart Example
Total: 160 + 30 + [Fedex Quote] USD = 190 + [Fedex Quote] USD
Question
Is there anyway to accomplish this?
After installed the plugin: FedEx WooCommerce Shipping with Print Label we didn't find any option for this use case.
Use Case: Multiple Shipping Methods per Order
Context
We have a WooCommerce online store with 2 products:
Framing Product. Price: 50 USD.
Print Product. Price: 20 USD.
Plugins installed:
FedEx WooCommerce Shipping with Print Label
...
Shipping Rates:
For Framing Products we need to apply a Flat Shipping Rate [ 15 USD ] since we deliver these products personally.
For Print Products we need to use Fedex delivery service.
Goal
We need to allow our customers to have in the same order both kind of products: { Framing Products, Print Products }.
Cart Example
Total: 160 + 30 + [Fedex Quote] USD = 190 + [Fedex Quote] USD
Question
Is there anyway to accomplish this?
After installed the plugin: FedEx WooCommerce Shipping with Print Label we didn't find any option for this use case.
Share Improve this question edited Jul 6, 2019 at 15:32 Angel asked Jul 6, 2019 at 15:13 AngelAngel 11 bronze badge1 Answer
Reset to default 0This case is possible with FedEx WooCommerce Shipping with Print Label. All you need is the following free add-ons and the code below.
- Hide WooCommerce Shipping Methods based on Shipping Class and Zones
- Skip Shipping calculation based on WooCommerce Shipping Class
These free plugins as well as, a similar case is already explained very well in the following documentation- WooCommerce Shipping – FedEx Live Rate Adjustment based on Shipping Classes.
Here is the code that you need to add to your functions.php file...
/**
* Snippet to Add an Additional Cost to the Shipping Service based on Shipping Class
* Created on 28 March 2019
* PluginHive Plugins: https://www.pluginhive/plugins/
**/
add_filter( 'woocommerce_package_rates', 'adjustment_in_rates_of_product_with_shipping_class', 12, 2 );
function adjustment_in_rates_of_product_with_shipping_class( $available_shipping_methods, $package ) {
// Shipping class slug that need to add extra cost
$shipping_class = array(
'other',
);
// Give here Extra Cost you want add
$extra_cost = 100;
// Enter the Shipping Method Value
$shipping_services = array(
'wf_shipping_ups:01',
'wf_shipping_ups:02',
'wf_shipping_ups:03',
'wf_shipping_ups:07',
'wf_shipping_ups:08',
'wf_shipping_ups:11',
'wf_shipping_ups:12',
'wf_shipping_ups:13',
'wf_shipping_ups:14',
'wf_shipping_ups:59',
'wf_shipping_ups:54',
'wf_shipping_ups:65',
'wf_shipping_ups:92',
'wf_shipping_ups:93',
'wf_shipping_ups:94',
);
$shipping_class_exists = false;
foreach(WC()->cart->get_cart_contents() as $key => $values) {
if ( in_array($values['data']->get_shipping_class() , $shipping_class) ) {
$shipping_class_exists = true;
break;
}
}
if ($shipping_class_exists) {
foreach ($available_shipping_methods as $key => $value) {
if ( in_array($value->get_id() , $shipping_services) ) {
$available_shipping_methods[$key]->cost += $extra_cost;
}
}
}
return $available_shipping_methods;
}
If you have any more query you can leave a comment.
本文标签: pluginsUse Case Multiple Shipping Methods per Order
版权声明:本文标题:plugins - Use Case: Multiple Shipping Methods per Order 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1745338262a2654142.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论