-
Notifications
You must be signed in to change notification settings - Fork 20
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix/issue 2562 - Add Retail Delivery Fee for Colorado #2834
base: trunk
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I suggest to create separate file that have custom fees, maybe even folder to store logic per each case in separate file (function) that will return fee data or false.
In main hooked method check if $custom_fees
contain item with $customer->get_shipping_country() . ':" . $customer->get_shipping_state()
.
$custom_fees = array(
'US:CO' => 'custom_function_name'
);
If matched include custom fee logic file and run custom_function_name
to check if fee should be applied, if should be applied return fee data.
array(
'value' => 0.27 // can be calculated
'label' => __( 'Retail Delivery Fee', 'woocommerce_services' ),
);
If fee should not be applied return false
.
if ( count( array_intersect( wc_get_chosen_shipping_method_ids(), apply_filters( 'woocommerce_local_pickup_methods', array( 'legacy_local_pickup', 'local_pickup' ) ) ) ) > 0 ) { | ||
return; | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should check if all chosen methods wc_get_chosen_shipping_method_ids()
are local_pickup, if anyone of them is not fee should be applied.
* | ||
* @param WC_Cart $cart WooCommerce Cart object. | ||
*/ | ||
public function add_custom_state_surcharge_fee( $cart ) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We have to check if Colorado state Sales or Use Tax is charged on the items (see if we already have those taxes applied) as usually when items are exempt from state Sales or Use Tax they are exempt from Retail Delivery Fee.
Description
Adding a function for custom surcharge ( retail delivery fee ) for Colorado state. This changes also introduce a new filter hook that the user can use to disable the custom surcharge addition.
Related issue(s)
Fixes #2562
Steps to reproduce & screenshots/GIFs
Checklist
changelog.txt
entry addedreadme.txt
entry added