I have noticed that my cart totals in WooCommerce are not adding up correctly after enabling a Flexible Shipping Table Rates plugin. I have products that will ship from multiple locations and therefore if two products from different shipping locations are added to the cart, two shipping methods are used. However, it seems when I choose to select the method I created from the Flexible Shipping plugin which I labelled “Express Shipping” the cart total only seems to add this method to the total cost. The other shipping method is using the Print on Demand plugin from Printful.
I think the issue is some sort of error in the method used to calculate the WooCommerce shipping sum totals. I have a link to the screenshot here:
https://purnimacreations.com/wp-content/uploads/2020/12/shipping-calc-issue.jpg
In order to recreate the issue for you to test it, select a pillow (https://purnimacreations.com/product/crafting-my-heritage-sewing-the-indian-patterns-throw-pillow/) from the shop page and add to cart, then select the handbag (https://purnimacreations.com/product/crafting-my-heritage-sewing-the-indian-patterns-purse-wristlet-handbag/) and add to cart. Currently, I have only set up an Asia Shipping zone for testing so enter an Asian country as per the screenshot. After which select the express shipping option for the relevant method.
I am not a programmer but am able to do some CSS and function overrides with instructed direction. Any help in identifying what the route issue is would be much appreciated.
Thanks,
Pow
]]>Just to note, I’m using the WooCommerce Table Rate Plugin which is why my shipping_methods all display as “table_rate”.
This is the code that was working prior to WooCommerce 3.4
add_action('woocommerce_checkout_create_order', 'before_checkout_create_order', 20, 2);
function before_checkout_create_order( $order, $data ) {
if( $order->has_shipping_method('table_rate:9' ) {
$order->update_meta_data( 'royal_mail_shipping_code', 'SD1' );
}
if( $order->has_shipping_method('table_rate:8') ) {
$order->update_meta_data( 'royal_mail_shipping_code', 'TPS48' );
}
else $order->update_meta_data( 'royal_mail_shipping_code', 'No Value' );
}
After WooCommerce 3.4 the “shipping_method” returns “table_rate” rather than “table_rate:9” so I now need a way to check the order shipping “instance_id” instead, but I can’t find any documentation on how to do this.
]]>I’m trying to add text to the email notification when a customer has chosen local pickup. I’m using the shipping zones in WooCommerce 2.6 and Table Rate Shipping plugin.
The code I have so far is:
add_action( 'woocommerce_email_before_order_table', 'add_order_email_lp', 10, 2 );
function add_order_email_lp( $order, $sent_to_admin ) {
if ( ! $sent_to_admin ) {
if ( 'local_pickup:14' == $order->shipping_method ) {
// shipping method
echo '<p><strong>Instructions:</strong> This is local pickup</p>';
} else {
// other methods
echo '<p><strong>Instructions:</strong>This is not local pickup</p>';
}
}
}
If I choose Local Pickup (which is this table rate: local_pickup:14) I’m not getting the correct text.
I found this function online somewhere and it was originally for adding text based on billing method.
Can anybody help me with this?
https://www.ads-software.com/plugins/woocommerce/
]]>I’m trying to add text to the email notification when a customer has chosen local pickup. I’m using the shipping zones in WooCommerce 2.6 and Table Rate Shipping plugin.
The code I have so far is:
add_action( 'woocommerce_email_before_order_table', 'add_order_email_lp', 10, 2 );
function add_order_email_lp( $order, $sent_to_admin ) {
if ( ! $sent_to_admin ) {
if ( 'local_pickup:14' == $order->shipping_method ) {
// shipping method
echo '<p><strong>Instructions:</strong> This is local pickup</p>';
} else {
// other methods
echo '<p><strong>Instructions:</strong>This is not local pickup</p>';
}
}
}
If I choose Local Pickup (which is this table rate: local_pickup:14) I’m not getting the correct text.
I found this function online somewhere and it was originally for adding text based on billing method.
Can anybody help me with this?
]]>Is there a way to ensure that either only the higher shipping rate is displayed, or a way to add the two shipping rates together at the checkout?
Thanks for your help!
https://www.ads-software.com/plugins/woocommerce/
]]>